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 913bc581d..dc1f43f10 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -64,21 +64,26 @@ public class AnimationState { TrackEntry current = tracks.get(i); if (current == null) continue; + TrackEntry next = current.next; + if (next != null) { + float nextTime = current.lastTime - next.delay; + if (nextTime >= 0) { + next.time = nextTime; + setCurrent(i, next); + current = next; + } + } else if (!current.loop && current.lastTime >= current.endTime) { + // End non-looping animation when it reaches its end time and there is no next entry. + clearTrack(i); + continue; + } + current.time += delta * current.timeScale; if (current.previous != null) { float previousDelta = delta * current.previous.timeScale; current.previous.time += previousDelta; current.mixTime += previousDelta; } - - TrackEntry next = current.next; - if (next != null) { - next.time = current.lastTime - next.delay; - if (next.time >= 0) setCurrent(i, next); - } else { - // End non-looping animation when it reaches its end time and there is no next entry. - if (!current.loop && current.lastTime >= current.endTime) clearTrack(i); - } } }