<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:webgl="http://www.xml3d.org/2009/xml3d/webgl"
      xmlns:x3d="http://www.web3d.org/specifications/x3d-namespace">
   <head>
      <title>DOM Modifications: Animations</title>
      <script src="http://www.xml3d.org/xml3d/script/xml3d-4.1-beta.js" type="text/javascript"/>
      <!-- Alternative for debugging <script src="http://xml3d.org/xml3d/scripts/xml3d-dev.js" type="text/javascript"/> -->
      <script src="http://www.xml3d.org/xml3d/script/tools/camera-4.1-beta.js" type="text/javascript"/>
      <script src="../build/output/xml3d-motion.js" type="text/javascript"/>
   </head>
   <body>
      <h1>Animatable</h1>
      <div style="color: red">
         <xml3d xmlns="http://www.xml3d.org/2009/xml3d" style="width: 512px; height: 512px; background-color:rgb(14,56,102);">
            <defs>
               <transform id="t_TRANS"/>
               <shader id="s_d1e23" script="urn:xml3d:shader:phong">
                  <float3 name="diffuseColor">1 0 0</float3>
                  <float3 name="specularColor">0 0 0</float3>
                  <float3 name="emissiveColor">0 0 0</float3>
                  <float name="transparency">0</float>
                  <float name="shininess">60</float>
                  <float name="ambientIntensity">0.2</float>
               </shader>
               <data id="animation01">
                    <float name="key">0 0.08 0.16 0.24 0.32 0.4 0.48 0.56 0.64 0.72 0.8 0.88 0.96</float>
                    <float3 name="position">0 0 0 -2 0 0 0 0 0 2 0 0 0 0 0 0 -2 0 0 0 0 0 2 0 0 0 0 0 0 -2 0 0 0 0 0 2 0 0 0</float3>
               </data>
               <data id="animation02">
                    <float name="key">0 0.1 0.18 0.24 0.3 0.36 0.42 0.48 0.54 0.6 0.66 0.72 0.78 0.84 0.9</float>
                    <float4 name="orientation">1 0 0 0 0.7073882818222046 0.7068251967430115 0 0 0.0007963267271406949 0.9999997019767761 0 0 -0.7062616348266602 0.7079508900642395 0 0 -0.9999987483024597 0.0015926528722047806 0 0 1 0 0 0 0.7073882818222046 0 0.7068251967430115 0 0.0007963267271406949 0 0.9999997019767761 0 -0.7062616348266602 0 0.7079508900642395 0 -0.9999987483024597 0 0.0015926528722047806 0 1 0 0 0 0.7073882818222046 0 0 0.7068251967430115 0.0007963267271406949 0 0 0.9999997019767761 -0.7062616348266602 0 0 0.7079508900642395 -0.9999987483024597 0 0 0.0015926528722047806 </float4>
               </data>
            </defs>
            <view position="0 0 10"/>
            <group id="root">
               <group>
                  <group id="TRANS" transform="#t_TRANS">
                     <group id="shape_d1e22" shader="#s_d1e23">
                        <mesh type="triangles" id="m_d1e25">
                           <int name="index">0 1 2 2 3 0 4 7 5 5 7 6 8 9 10 10 11 8 12 14 13 14 12 15 16 17 18 18 19 16 20 22 21 22 20 23 </int>
                           <float3 name="position">-1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 -1.0 1.0 -1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 </float3>
                           <float3 name="normal">0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 </float3>
                           <float2 name="texcoord">1.0 0.0 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 </float2>
                        </mesh>
                     </group>
                  </group>
               </group>
            </group>
         </xml3d>
      </div>
      <div>
        <div>
        <button onclick="startPositionAnimation()">Animate position</button>
         </div>
         <div>
            <button onclick="startOrientationAnimation()">Animate orientation</button>
         </div>
         <div>
            <button onclick="stopAnimations()">Stop all animations</button>
         </div>
      </div>
      <div id="footer"/>

<script type="text/javascript">
  var movObjects = {}, factory = new XMOT.ClientMotionFactory;
  var constraint = new XMOT.CollisionConstraint(5,5,[0,1,0],"collision.png");

  function startPositionAnimation() {
      var aobj = movObjects.cube;
      if(!aobj)  {
          aobj = movObjects.cube = createAnimatable();
      }
      aobj.startAnimation("a1", {duration: 3, id: "id12"});
  }

  function startOrientationAnimation()
  {
      var aobj = movObjects.cube;
      if(!aobj) {
          aobj = movObjects.cube = createAnimatable();
      }
      aobj.startAnimation("a2");
  }

  function startTwoAnimations()  {
      var aobj = movObjects.cube;
      if(!aobj) {
          aobj = movObjects.cube = createAnimatable();
      }
      aobj.startAnimation("a2").startAnimation("a1");
  }

  function stopAnimations() {
      var aobj;
      if(!(aobj = movObjects.cube)) 
          return;
      aobj.stopAnimation("id12");
  }

  function createAnimatable() {
      var c = factory.createAnimatable(document.getElementById("shape_d1e22"), constraint);
      var a1 = factory.createKeyframeAnimation("a1", "translation", document.getElementById("animation01"), {duration: 2000, loop:false});
      var a2 = factory.createKeyframeAnimation("a2", "rotation", document.getElementById("animation02"));
      c.addAnimation(a1);
      c.addAnimation(a2, {duration: 5000, loop: true});
      return c;
  }
</script>
      <br/>
   </body>
</html><commit_msg>Small fixes in the animatable example<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:webgl="http://www.xml3d.org/2009/xml3d/webgl"
      xmlns:x3d="http://www.web3d.org/specifications/x3d-namespace">
   <head>
      <title>DOM Modifications: Animations</title>
      <script src="http://www.xml3d.org/xml3d/script/xml3d-4.1-beta.js" type="text/javascript"/>
      <!-- Alternative for debugging <script src="http://xml3d.org/xml3d/scripts/xml3d-dev.js" type="text/javascript"/> -->
      <script src="http://www.xml3d.org/xml3d/script/tools/camera-4.1-beta.js" type="text/javascript"/>
      <script src="../build/output/xml3d-motion.js" type="text/javascript"/>
   </head>
   <body>
      <h1>Animatable</h1>
      <div style="color: red">
         <xml3d xmlns="http://www.xml3d.org/2009/xml3d" style="width: 512px; height: 512px; background-color:rgb(14,56,102);">
            <defs>
               <transform id="t_TRANS"/>
               <shader id="s_d1e23" script="urn:xml3d:shader:phong">
                  <float3 name="diffuseColor">1 0 0</float3>
                  <float3 name="specularColor">0 0 0</float3>
                  <float3 name="emissiveColor">0 0 0</float3>
                  <float name="transparency">0</float>
                  <float name="shininess">60</float>
                  <float name="ambientIntensity">0.2</float>
               </shader>
               <data id="animation01">
                    <float name="key">0 0.08 0.16 0.24 0.32 0.4 0.48 0.56 0.64 0.72 0.8 0.88 0.96</float>
                    <float3 name="position">0 0 0 -2 0 0 0 0 0 2 0 0 0 0 0 0 -2 0 0 0 0 0 2 0 0 0 0 0 0 -2 0 0 0 0 0 2 0 0 0</float3>
               </data>
               <data id="animation02">
                    <float name="key">0 0.1 0.18 0.24 0.3 0.36 0.42 0.48 0.54 0.6 0.66 0.72 0.78 0.84 0.9</float>
                    <float4 name="orientation">1 0 0 0 0.7073882818222046 0.7068251967430115 0 0 0.0007963267271406949 0.9999997019767761 0 0 -0.7062616348266602 0.7079508900642395 0 0 -0.9999987483024597 0.0015926528722047806 0 0 1 0 0 0 0.7073882818222046 0 0.7068251967430115 0 0.0007963267271406949 0 0.9999997019767761 0 -0.7062616348266602 0 0.7079508900642395 0 -0.9999987483024597 0 0.0015926528722047806 0 1 0 0 0 0.7073882818222046 0 0 0.7068251967430115 0.0007963267271406949 0 0 0.9999997019767761 -0.7062616348266602 0 0 0.7079508900642395 -0.9999987483024597 0 0 0.0015926528722047806 </float4>
               </data>
            </defs>
            <view position="0 0 10"/>
            <group id="root">
               <group>
                  <group id="TRANS" transform="#t_TRANS">
                     <group id="shape_d1e22" shader="#s_d1e23" transform="#t_TRANS">
                        <mesh type="triangles" id="m_d1e25">
                           <int name="index">0 1 2 2 3 0 4 7 5 5 7 6 8 9 10 10 11 8 12 14 13 14 12 15 16 17 18 18 19 16 20 22 21 22 20 23 </int>
                           <float3 name="position">-1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 -1.0 1.0 -1.0 -1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 1.0 -1.0 1.0 1.0 -1.0 -1.0 </float3>
                           <float3 name="normal">0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 0.0 -1.0 0.0 </float3>
                           <float2 name="texcoord">1.0 0.0 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 </float2>
                        </mesh>
                     </group>
                  </group>
               </group>
            </group>
         </xml3d>
      </div>
      <div>
        <div>
        <button onclick="startPositionAnimation()">Animate position</button>
         </div>
         <div>
            <button onclick="testSomething()">Test Something</button>
         </div>
         <div>
            <button onclick="startOrientationAnimation()">Animate orientation</button>
         </div>
         <div>
            <button onclick="stopAnimations()">Stop Position animation</button>
         </div>
      </div>
      <div id="footer"/>

<script type="text/javascript">
  var movObjects = {}, factory = new XMOT.ClientMotionFactory;
  var constraint = new XMOT.CollisionConstraint(5,5,[0,1,0],"collision.png");
  var id = 0;

  function startPositionAnimation() {
      var aobj = movObjects.cube;
      if(!aobj)  {
          aobj = movObjects.cube = createAnimatable();
      }
      id = aobj.startAnimation("a1", {duration: 30000});
  }

  function startOrientationAnimation()
  {
      var aobj = movObjects.cube;
      if(!aobj) {
          aobj = movObjects.cube = createAnimatable();
      }
      aobj.startAnimation("a2");
  }

  function startTwoAnimations()  {
      var aobj = movObjects.cube;
      if(!aobj) {
          aobj = movObjects.cube = createAnimatable();
      }
      aobj.startAnimation("a2").startAnimation("a1");
  }

  function stopAnimations() {
      var aobj;
      if(!(aobj = movObjects.cube)) 
          return;
      aobj.stopAnimation(id);
  }

  function createAnimatable() {
      var c = factory.createAnimatable(document.getElementById("shape_d1e22"), constraint);
      var a1 = factory.createKeyframeAnimation("a1", "Position", document.getElementById("animation01"), {duration: 2000, loop:false});
      var a2 = factory.createKeyframeAnimation("a2", "Orientation", document.getElementById("animation02"));
      c.addAnimation(a1);
      c.addAnimation(a2, {duration: 5000, loop: true});
      return c;
  }
  function testSomething(){
  	var m = factory.createMoveable(document.getElementById("shape_d1e22"), constraint);
  	m.moveTo([0,0,0], undefined, 1000).moveTo([-5,0,0], undefined, 1000).moveTo([0,0,0], undefined, 1000).moveTo([5,0,0], undefined, 1000).moveTo([0,-5,0], undefined, 1000).moveTo([0,0,0], undefined, 1000).moveTo([0,5,0], undefined, 1000).moveTo([0,0,0], undefined, 1000).moveTo([0,0,-5], undefined, 1000).moveTo([0,0,0], undefined, 1000).moveTo([0,0,5], undefined, 1000).moveTo([0,0,0], undefined, 1000);
  }
</script>
      <br/>
   </body>
</html>
{'fraction_non_alphanumeric': 0.16722800971254015, 'fraction_numerical': 0.1887679172867549, 'mean_word_length': 1.9776119402985075, 'pattern_counts': {'":': 0, '<': 181, '<?xml version=': 2, '>': 181, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 42}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '481388', 'n_tokens_mistral': 6363, 'n_tokens_neox': 4989, 'n_words': 1191}