How to add in Tween js in Three js?

374 Views Asked by At

Hello I would like to ask something about Tween js and Three js. Actually I have created the particles and it can start rotate by using Three js.

The complete particles

But when I adding this coding then the rotation is stopped. I am added down at the particles render there.

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();     
    }

Can I know what is the problem? Waiting for reply.Thanks

0

There are 0 best solutions below