当前位置:网站首页>three.js Frame animation

three.js Frame animation

2020-12-06 20:57:42 Web and webgl

three.js Frame animation

Go straight to the code , If you have any questions, please discuss them in groups :1047907561

        var mixer,
        var posTrack = new THREE.KeyframeTrack(
              "Build.position",
              [0, 20],
              [0, 0, 0, -100, 0, 0]// The first three are the starting positions , The last three are the positions after moving 
            );
            var scaleTrack = new THREE.KeyframeTrack(
              "Floor.scale",
              [0, 1],
              [2, 2, 2, 5, 5, 5]  // The first three values are the starting value size , After that is the enlarged value 
            );
            var clip = new THREE.AnimationClip("default", 1, [
               posTrack,scaleTrack
            ]);
            mixer = new THREE.AnimationMixer(mesh);// The value inside is the object that needs to be animated 
            var AnimationAction = mixer.clipAction(clip);
            AnimationAction.timeScale = 5; // Default 1, You can adjust the playback speed 
                AnimationAction.loop = THREE.LoopOnce;
            AnimationAction.clampWhenFinished = true;
            AnimationAction.time = 0;
            clip.duration = 1;
            AnimationAction5.play();


        function render(){
  

               var time = clock.getDelta();
                    if (mixer) {
                      mixer.update(time);
                 }

 

        }

版权声明
本文为[Web and webgl]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201206205631092n.html