gpt4 book ai didi

java - Universal Tween Engine 中的时间控制

转载 作者:行者123 更新时间:2023-11-30 02:43:37 25 4
gpt4 key购买 nike

Timeline.createSequence()
.push(Tween.set(cuptop1, SpriteAccessor.ALPHA).target(0).start(tweenManager))
.push(Tween.set(cuptop2, SpriteAccessor.ALPHA).target(0).start(tweenManager))

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.ALPHA,0.5f).delay(0.5f).target(1).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.ALPHA,0.5f).delay(0.3f).target(1).start(tweenManager))
.start(tweenManager)
)

.pushPause(1)

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(10,10).ease(TweenEquations.easeNone).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(20,20).ease(TweenEquations.easeNone).start(tweenManager))
.start(tweenManager)
)

.pushPause(1)

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(100,100).ease(TweenEquations.easeNone).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(200,200).ease(TweenEquations.easeNone).start(tweenManager))
.start(tweenManager)
)
.start(tweenManager);

嗨,我是编程新手。我正在使用补间引擎制作动画。

应该是这样的:

首先,2个杯子分别同时出现在(100, 100)和(200, 200)处。
一秒后,2个杯子同时分别移动到(10, 10)和(20, 20)。
最后,它们同时回到原来的位置。returns

然而,这 3 个步骤同时发生并忽略了 pushPause。我该如何纠正它?谢谢!

最佳答案

问题是您将 .start(tweenManager) 调用到触发 3 个连续动画中的每一个立即运行的内部声明中。

你的代码应该是这样的:

Timeline.createSequence()
.push(Tween.set(cuptop1, SpriteAccessor.ALPHA).target(0).start(tweenManager))
.push(Tween.set(cuptop2, SpriteAccessor.ALPHA).target(0).start(tweenManager))

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.ALPHA,0.5f).delay(0.5f).target(1).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.ALPHA,0.5f).delay(0.3f).target(1).start(tweenManager))
)

.pushPause(1)

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(10,10).ease(TweenEquations.easeNone).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(20,20).ease(TweenEquations.easeNone).start(tweenManager))
)

.pushPause(1)

.push(Timeline.createParallel()
.push(Tween.to(cuptop1, SpriteAccessor.POS_XY, 1.0f).target(100,100).ease(TweenEquations.easeNone).start(tweenManager))
.push(Tween.to(cuptop2, SpriteAccessor.POS_XY, 1.0f).target(200,200).ease(TweenEquations.easeNone).start(tweenManager))
)

.start(tweenManager);

关于java - Universal Tween Engine 中的时间控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25421537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com