I want to rotate a cube on world axis by using tween.I am able to rotate the cube around world axis without using tween by using
rotateAroundWorldAxis(cube[1], new THREE.Vector3(0,1,0),degreeToRadians(90));
but I want to happen this slowly so I want to use it with tween.
I was using
var start = {x:cube[1].rotation.x, y:cube[1].rotation.y, z:cube[1].rotation.z};
var end = {x:cube[1].rotation.x , y:cube[1].rotation.y+degreeToRadians(90) ,
z:cube[1].rotation.z};
var tween = new TWEEN.Tween(start)
.to(end, 1000)
.easing( TWEEN.Easing.Exponential.InOut )
.onUpdate(function(){
cube[1].rotation.x = this.x;
cube[1].rotation.y = this.y;
cube[1].rotation.z = this.z;
})
.start()
before, but it was rotating the cube around object axis.So,I switched to
rotateAroundWorldAxis(cube[1], new THREE.Vector3(0,1,0),degreeToRadians(90));
but how to use it with tween?
You can use tween to change a generic value from 0 to 90 and then in the update use the rotateAroundWorldAxis function
in tween initialization
in onUpdate