mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Fixed AnimationState bug.
This commit is contained in:
parent
0c1c0a3dc6
commit
7d7e56bb24
@ -78,13 +78,15 @@ void AnimationState_setAnimation (AnimationState* self, Animation* newAnimation,
|
|||||||
if (internal->mixDuration > 0) {
|
if (internal->mixDuration > 0) {
|
||||||
internal->mixTime = 0;
|
internal->mixTime = 0;
|
||||||
internal->previous = self->animation;
|
internal->previous = self->animation;
|
||||||
|
internal->previousTime = self->time;
|
||||||
|
internal->previousLoop = self->loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CONST_CAST(Animation*, self->animation) = newAnimation;
|
CONST_CAST(Animation*, self->animation) = newAnimation;
|
||||||
self->loop = loop;
|
self->loop = loop;
|
||||||
self->time = 0;
|
self->time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -60,25 +60,22 @@ public class AnimationState {
|
|||||||
current.apply(skeleton, currentTime, currentLoop);
|
current.apply(skeleton, currentTime, currentLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the current animation. */
|
/** Set the current animation. The current animation time is set to 0.
|
||||||
|
* @param animation May be null. */
|
||||||
public void setAnimation (Animation animation, boolean loop) {
|
public void setAnimation (Animation animation, boolean loop) {
|
||||||
setAnimation(animation, loop, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set the current animation.
|
|
||||||
* @param time The time within the animation to start. */
|
|
||||||
public void setAnimation (Animation animation, boolean loop, float time) {
|
|
||||||
previous = null;
|
previous = null;
|
||||||
if (animation != null && current != null) {
|
if (animation != null && current != null) {
|
||||||
mixDuration = data.getMix(current, animation);
|
mixDuration = data.getMix(current, animation);
|
||||||
if (mixDuration > 0) {
|
if (mixDuration > 0) {
|
||||||
mixTime = 0;
|
mixTime = 0;
|
||||||
previous = current;
|
previous = current;
|
||||||
|
previousTime = currentTime;
|
||||||
|
previousLoop = currentLoop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current = animation;
|
current = animation;
|
||||||
currentLoop = loop;
|
currentLoop = loop;
|
||||||
currentTime = time;
|
currentTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return May be null. */
|
/** @return May be null. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user