【问题标题】:How to move camera along a straight line in Three.js?如何在 Three.js 中沿直线移动相机?
【发布时间】:2015-06-26 17:31:10
【问题描述】:

我刚刚开始使用 Three.js 和一般的图形编程。我要做的就是将相机从一个位置平稳过渡到另一个位置。

我发现的一个解决方案使用了 PathControls.js,该文件已被删除。

【问题讨论】:

  • 搜索tween 可能会对您有所帮助

标签: graphics camera three.js


【解决方案1】:

这个功能应该有帮助。需要 tween.js,你可以在 three.js 的 examples/js/libs 文件夹中找到它

function setupCameraPositionTween( source, target, duration, delay, easing )
{
    var l_delay = ( delay !== undefined ) ? delay : 0;
    var l_easing = ( easing !== undefined ) ? easing : TWEEN.Easing.Linear.None;

    new TWEEN.Tween( source )
        .to( target, duration )
        .delay( l_delay )
        .easing( l_easing )
        .onUpdate ( function()
            {
                // copy incoming position into camera position
                camera.position.copy( source );
            })
        .start();
}

【讨论】:

  • 谢谢!解决了我眼前的问题,但现在我有一系列全新的问题要处理。事情就是这样,谢谢!
猜你喜欢
  • 1970-01-01
  • 2013-03-17
  • 2016-03-16
  • 1970-01-01
  • 2013-08-14
  • 1970-01-01
  • 2014-06-25
  • 1970-01-01
  • 2012-07-21
相关资源
最近更新 更多