From f7ae127115b34da24a67db678a41171665fd755b Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Mon, 4 Oct 2021 00:58:42 -1000 Subject: [PATCH] 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. --- .../com/esotericsoftware/spine/AnimationState.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 9cbaa732d..f0f7692cc 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -1012,16 +1012,20 @@ public class AnimationState { nextAnimationLast = animationLast; } - /** Uses {@link #getTrackTime()} to compute the animationTime, which is between {@link #getAnimationStart()} - * and {@link #getAnimationEnd()}. When the trackTime is 0, the animationTime is equal to the - * animationStart time. */ + /** Uses {@link #getTrackTime()} to compute the animationTime. When the trackTime is 0, the + * animationTime is equal to the animationStart time. + *

+ * The animationTime 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 + * animationTime 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