threejs Tween插件

Tween

 var twe = new TWEEN.Tween(sprite.position)
                .to({x:600}, time * 16.6)
			   .easing(TWEEN.Easing.Exponential.InOut) 
												                                                                                                                                                                                      
 twe.start();

//在渲染函数中
function animate(time) {		
			TWEEN.update();
			render();
			}

sprite.position是一个对象的位置,
可以在 time * 16.6时间内将对象位置的x坐标变成600,easing()设置坐标变化的速率,
当x到达目标位置后,动画会自动停止。

API地址:https://github.com/tweenjs/tween.js/blob/master/docs/user_guide.md

猜你喜欢

转载自blog.csdn.net/weixin_43081805/article/details/89396449