【问题标题】:tween control.reset() of trackball controls js not working轨迹球控件 js 的补间 control.reset() 不起作用
【发布时间】:2015-04-23 07:43:42
【问题描述】:

查看此链接 www.naamdesigns.com/arv

每次单击任何链接时,我都想将球体旋转回其原始位置。 我正在尝试重置相机位置及其工作。但我无法补间重置旋转。怎么办?

function camreset(){
    //var object = new THREE.Object3D();
    new TWEEN.Tween( camera.position )
                    .to( controls.reset() ,5000)
                    .easing( TWEEN.Easing.Exponential.InOut )
                    .onUpdate( render )
                    .start();


    }

【问题讨论】:

    标签: javascript jquery three.js tween


    【解决方案1】:

    我先来看看轨迹球控件重置功能的作用。该函数通过设置当前“目标”和“对象”位置以及“对象”向上矢量来进行定位。

    _this.target.copy( _this.target0 );
    _this.object.position.copy( _this.position0 );
    _this.object.up.copy( _this.up0 );
    

    上面摘自 r70 Three.js TrackballControls.js。所以忘记使用重置功能,我想你可以在补间完成后。

    因此,假设您的轨迹球控件名为 controls,我将简单地将 controls.targetcontrols.object.positioncontrols.object.up 补间回它们定义的默认值,如上面提到的 controls.target0controls.position0 和 @ 987654328@。例如:

    var tweenPositionToReset = new TWEEN.Tween( controls.object.position )
        .to( { x: controls.position0.x, y: controls.position0.y, z: controls.position0.z }, 500 )
        .easing( TWEEN.Easing.Quadratic.In )
        .start();
    

    当然,您是否也需要对其他两个向量执行此操作。希望有帮助!祝你好运

    【讨论】:

      猜你喜欢
      • 2013-09-19
      • 2013-01-21
      • 1970-01-01
      • 2012-10-02
      • 2016-09-17
      • 2012-12-17
      • 2013-11-24
      • 2015-04-21
      • 2020-08-05
      相关资源
      最近更新 更多