我试图在球体上用ThreeJS渲染的全景图之间达到一种效果。
实际上,我正在使用TweenMax移动实际场景以进行计时和缓和,但我想将它带给您在StreetView上获得的快速移动效果。
这是我用于转换的一段代码:
var vector = new THREE.Vector3( 0, 0, 0);
camera.getWorldDirection(vector);
var duration = 450;
var tweenRoomOut = new TWEEN.Tween(scene.position)
.to({
x: -1 * vector.x * 300,
y: -1 * vector.y * 300,
z: -1 * vector.z * 300,
}, duration)
.easing(TWEEN.Easing.Exponential.Out)
.onComplete( () => {
//When finished, restart position so the scene returns to its origin
scene.position.x = vector.x;
scene.position.y = vector.y;
scene.position.z = vector.z;
})
.start();