Negative speed now plays an animation backwards
This commit is contained in:
parent
7ded33051c
commit
a463f5515a
@ -22,7 +22,10 @@ public abstract class Action implements Tween {
|
||||
|
||||
@Override
|
||||
public boolean interpolate(double t) {
|
||||
return subInterpolate(t * speed);
|
||||
t = t * speed;
|
||||
// make sure negative time is in [0, length] range
|
||||
t = (t % length + length) % length;
|
||||
return subInterpolate(t);
|
||||
}
|
||||
|
||||
public abstract boolean subInterpolate(double t);
|
||||
|
@ -165,20 +165,14 @@ public class TestAnimMigration extends SimpleApplication {
|
||||
composer.actionSequence("Sequence",
|
||||
composer.makeAction("Walk"),
|
||||
composer.makeAction("Run"),
|
||||
composer.makeAction("Jumping")).setSpeed(4);
|
||||
composer.makeAction("Jumping")).setSpeed(2);
|
||||
|
||||
action = composer.actionBlended("Blend", new LinearBlendSpace(1, 4),
|
||||
"Walk", "Run");
|
||||
|
||||
action.getBlendSpace().setValue(1);
|
||||
|
||||
composer.action("Walk").setSpeed(2);
|
||||
|
||||
// composer.actionSequence("Sequence",
|
||||
// composer.tweenFromClip("Walk"),
|
||||
// composer.tweenFromClip("Dodge"),
|
||||
// composer.tweenFromClip("push"));
|
||||
|
||||
composer.action("Walk").setSpeed(-1);
|
||||
|
||||
anims.addFirst("Sequence");
|
||||
anims.addFirst("Blend");
|
||||
|
Loading…
x
Reference in New Issue
Block a user