看雪物联网安全入门
假设有一个对象 position ,它的坐标为 x 和 y
var position = { x: 100, y: 0 }
改变 x 的值从 100 到 200 ,持续时间为 1s
var tween = new TWEEN.Tween(position)tween.to({x: 200}, 1000)
创建 tween 对象后,激活它,从而让它开始动画
tween.start();
为了平滑的动画效果,需要在同一个循环动画中调用 TWEEN.update 方法
animate();function animate(){
requestAnimationFrame(animate);
TWEEN.update();}