直接上代码,有疑惑请加群讨论:854184700

        var mixer,
        var posTrack = new THREE.KeyframeTrack(
              "Build.position",
              [0, 20],
              [0, 0, 0, -100, 0, 0]//前三个为起始位置,后三个为移动后的位置
            );
            var scaleTrack = new THREE.KeyframeTrack(
              "Floor.scale",
              [0, 1],
              [2, 2, 2, 5, 5, 5]  //前三个值为起始值大小,后面为放大后的值
            );
            var clip = new THREE.AnimationClip("default", 1, [
               posTrack,scaleTrack
            ]);
            mixer = new THREE.AnimationMixer(mesh);//里面的值为需要做动画的对象
            var AnimationAction = mixer.clipAction(clip);
            AnimationAction.timeScale = 5; //默认1,可以调节播放速度
                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);
                 }

 

        }

 

 

自动适配屏幕尺寸   +   自动适配尺寸

function onWindowResize() {

var w = container.clientWidth;
var h = container.clientHeight;

camera.aspect = w / h;
camera.updateProjectionMatrix();

renderer.setSize( w, h );

resolution.set( w, h );

}

window.addEventListener( 'resize', onWindowResize );

 

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-26
  • 2021-09-26
  • 2022-02-04
  • 2022-02-04
  • 2021-10-12
  • 2022-01-08
相关资源
相似解决方案