如何在三个js中添加Tween js?

时间:2016-12-23 06:37:33

标签: javascript html css three.js tweenjs

您好我想问一下Tween js和Three js。实际上我已经创建了粒子,它可以通过使用三个j开始旋转。

The complete particles

但是当我添加这个编码时,旋转就会停止。我在那里的粒子渲染下添加了。

var testing = document.getElementById("sphere");
var tween = new TWEEN.Tween({x: 0, y:0, rotation :0})
.to ({x:400,y:0, rotation:90},2000)
.onUpdate ( 

function (){
    testing.style.left = this.x +"px";
    }).start ();
}
function animate (){
    requestAnimationFrame(animate);
    TWEEN.update();     
    }

我能知道这是什么问题吗?等待回复。谢谢

0 个答案:

没有答案
相关问题