mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
Better animation state test.
This commit is contained in:
parent
b58d02ee4b
commit
8957454847
@ -57,6 +57,7 @@ public class AnimationStateTest extends ApplicationAdapter {
|
|||||||
// Define mixing between animations.
|
// Define mixing between animations.
|
||||||
AnimationStateData mixing = new AnimationStateData();
|
AnimationStateData mixing = new AnimationStateData();
|
||||||
mixing.setMix(walkAnimation, jumpAnimation, 0.4f);
|
mixing.setMix(walkAnimation, jumpAnimation, 0.4f);
|
||||||
|
mixing.setMix(jumpAnimation, walkAnimation, 0.4f);
|
||||||
|
|
||||||
state = new AnimationState(mixing);
|
state = new AnimationState(mixing);
|
||||||
state.setAnimation(walkAnimation, true);
|
state.setAnimation(walkAnimation, true);
|
||||||
@ -77,8 +78,12 @@ public class AnimationStateTest extends ApplicationAdapter {
|
|||||||
batch.begin();
|
batch.begin();
|
||||||
|
|
||||||
state.apply(skeleton);
|
state.apply(skeleton);
|
||||||
|
if (state.getAnimation() == walkAnimation) {
|
||||||
// After one second, change the current animation. Mixing is done by AnimationState for you.
|
// After one second, change the current animation. Mixing is done by AnimationState for you.
|
||||||
if (state.getTime() > 1 && state.getAnimation() == walkAnimation) state.setAnimation(jumpAnimation, false);
|
if (state.getTime() > 2) state.setAnimation(jumpAnimation, false);
|
||||||
|
} else {
|
||||||
|
if (state.getTime() > 1) state.setAnimation(walkAnimation, true);
|
||||||
|
}
|
||||||
skeleton.updateWorldTransform();
|
skeleton.updateWorldTransform();
|
||||||
skeleton.draw(batch);
|
skeleton.draw(batch);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user