mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 23:34:53 +08:00
Changed AnimationState animation time so it continues past animation end if non-looping and animation end is >= animation duration.
This allows sequences to continue to play in the common case where animation end is not being used to stop the animation early.
This commit is contained in:
parent
515d238886
commit
f7ae127115
@ -1012,16 +1012,20 @@ public class AnimationState {
|
||||
nextAnimationLast = animationLast;
|
||||
}
|
||||
|
||||
/** Uses {@link #getTrackTime()} to compute the <code>animationTime</code>, which is between {@link #getAnimationStart()}
|
||||
* and {@link #getAnimationEnd()}. When the <code>trackTime</code> is 0, the <code>animationTime</code> is equal to the
|
||||
* <code>animationStart</code> time. */
|
||||
/** Uses {@link #getTrackTime()} to compute the <code>animationTime</code>. When the <code>trackTime</code> is 0, the
|
||||
* <code>animationTime</code> is equal to the <code>animationStart</code> time.
|
||||
* <p>
|
||||
* The <code>animationTime</code> is between {@link #getAnimationStart()} and {@link #getAnimationEnd()}, except if this
|
||||
* track entry is non-looping and {@link #getAnimationEnd()} is >= to the animation {@link Animation#duration}, then
|
||||
* <code>animationTime</code> continues to increase past {@link #getAnimationEnd()}. */
|
||||
public float getAnimationTime () {
|
||||
if (loop) {
|
||||
float duration = animationEnd - animationStart;
|
||||
if (duration == 0) return animationStart;
|
||||
return (trackTime % duration) + animationStart;
|
||||
}
|
||||
return Math.min(trackTime + animationStart, animationEnd);
|
||||
float animationTime = trackTime + animationStart;
|
||||
return animationEnd >= animation.duration ? animationTime : Math.min(animationTime, animationEnd);
|
||||
}
|
||||
|
||||
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user