2015-05-04 51 views
0

我使用three.js css3d全景,我想停止加載動畫。我想加載一個靜態的panomara,它只會移動用戶操作。我怎樣才能做到這一點?three.js css3d全景停止加載動畫

我正在使用的代碼是實施http://threejs.org/examples/#css3d_panorama相同:

function animate() { 

    requestAnimationFrame(animate); 

    lon += 0.1; 
    lat = Math.max(- 85, Math.min(85, lat)); 
    phi = THREE.Math.degToRad(90 - lat); 
    theta = THREE.Math.degToRad(lon); 

    target.x = Math.sin(phi) * Math.cos(theta); 
    target.y = Math.cos(phi); 
    target.z = Math.sin(phi) * Math.sin(theta); 

    camera.lookAt(target); 

    renderer.render(scene, camera); 

} 

感謝您對以下幫助

回答

0

您的繼承人問題:

lat = Math.max(- 85, Math.min(85, lat)); 
    phi = THREE.Math.degToRad(90 - lat); 
    theta = THREE.Math.degToRad(lon); 

    target.x = Math.sin(phi) * Math.cos(theta); 
    target.y = Math.cos(phi); 
    target.z = Math.sin(phi) * Math.sin(theta); 

你看上面的行動畫你的相機。

camera.lookAt(target); // see the importance 

相機正在看目標,從我看到的是targetx,Y,Z位置已申請隨着時間的推移動畫:target.z = Math.sin(phi) * Math.sin ,比你的渲染器渲染場景 - >相機 - >你的目標。