我正在尝试使用java通用补间引擎来摇动对象。
以下是代码。 但只有第一个动画才会运行。有人可以帮我吗?
float time = 0.5f;
float shakeAngle = 10;
Timeline.createSequence()
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*2.0f))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*-1.0f))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*0.0f))
.start(TweenManagerHelper.sharedInstance().manager);
答案 0 :(得分:0)
我不使用Tween引擎,但环顾四周我找到了它的用法示例:
以下是对您有用的相关部分:
float time = 0.5f;
float shakeAngle = 10;
Timeline.createSequence()
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*2.0f).ease(Quad.INOUT))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*-1.0f).ease(Quad.INOUT))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*0.0f).ease(Quad.INOUT))
.start(TweenManagerHelper.sharedInstance().manager);
答案 1 :(得分:0)
尝试添加.beginSequence()和end()函数。 .beginSequence()紧跟在时间轴中最后一个动画之后的CreateSequence()和end()之后
float time = 0.5f;
float shakeAngle = 10;
Timeline.createSequence()
.beginSequence()
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*2.0f))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*-1.0f))
.push(Tween.to(this, TWEEN_ROTATION, 0.5f).target(shakeAngle*0.0f))
.end()
.start(TweenManagerHelper.sharedInstance().manager);