且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用tween.js绕世界轴旋转对象

更新时间:2023-02-02 16:32:12

您可以使用补间将通用值从0更改为90,然后在更新中使用rotateAroundWorldAxis函数

You can use tween to change a generic value from 0 to 90 and then in the update use the rotateAroundWorldAxis function

var cubeAngle = 0; // use this global variable if you want to rotate more than one time

一次以上,请使用此全局变量>

in tween initialization

var start = {angle: cubeAngle};
var end = {angle: cubeAngle + 90};

在onUpdate

cubeAngle=this.angle;    
rotateAroundWorldAxis(cube[1], new THREE.Vector3(0,1,0),degreeToRadians(cubeAngle));