Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Tween.js-是否可以在变量之间切换?_Javascript_Three.js_Tween.js_Tweenjs - Fatal编程技术网

Javascript Tween.js-是否可以在变量之间切换?

Javascript Tween.js-是否可以在变量之间切换?,javascript,three.js,tween.js,tweenjs,Javascript,Three.js,Tween.js,Tweenjs,所以我一直在玩three.js和tween.js,我想知道是否有可能在一个变量之间切换 我所尝试的: (一) 两者都给出了这样的结果:对象原型只能是一个对象或空值:0.001 我甚至不确定变量是否可以设置动画。有人可以确认吗?在.to()中,您需要在.Tween()的对象中传递duration和一个对象,该对象具有您要更改的属性及其值。 因此,您的代码如下所示: tween=新tween.tween(渲染器GL) 。至({toneMappingExposure:0.001},1000) .e

所以我一直在玩three.js和tween.js,我想知道是否有可能在一个变量之间切换

我所尝试的:

(一)

  • 两者都给出了这样的结果:
    对象原型只能是一个对象或空值:0.001

    我甚至不确定变量是否可以设置动画。有人可以确认吗?

    .to()
    中,您需要在
    .Tween()
    的对象中传递duration和一个对象,该对象具有您要更改的属性及其值。 因此,您的代码如下所示:

    tween=新tween.tween(渲染器GL)
    。至({toneMappingExposure:0.001},1000)
    .easing(TWEEN.easing.index.InOut)
    .start()
    
    似乎需要这样:
    tween=new tween.tween(renderegl).to({toneMappingExposure:0.001},1000).easing(tween.easing.index.InOut).start()
    @prisoner849谢谢!如果你把它作为一个答案,我可以把它标记为正确:)
    tween = new TWEEN.Tween(renderergl.toneMappingExposure).to( "0.001", 1000 ).easing(TWEEN.Easing.Exponential.InOut).onComplete(function() {
    // Finished
    }).start();
    
    tween = new TWEEN.Tween(renderergl.toneMappingExposure).to( 0.001, 1000 ).easing(TWEEN.Easing.Exponential.InOut).onComplete(function() {
    // Finished
    }).start();
    
    var toneMap = renderergl.toneMappingExposure;
    tween = new TWEEN.Tween(toneMap).to( "0.001", 1000 ).easing(TWEEN.Easing.Exponential.InOut).onComplete(function() { }).start();