一般情况下,它看起来就像这样:
var speed = 5; // units a second, the speed we want
var currentPoint = new THREE.Vector3(); // we will re-use it
// this part is in a function of event listener of, for example, a button
currentPoint.copy(cube.position); // cube is the object to move
var distance = currentPoint.distanceTo(destinationPoint.position)
var duration = (distance/speed) * 1000; // in milliseconds
new TWEEN.Tween(cube.position)
.to(destinationPoint.position, duration) // destinationPoint is the object of destination
.start();
jsfiddle例子。看看tweening()
函数。
你知道距离,你有期望的速度,所以时间就是距离/速度。您在哪里以及如何设置补间的时间? – prisoner849
持续时间是tween.to的第二个参数(对象,持续时间) – Radio