Эх сурвалжийг харах

Apply remaining time to next animation.

Previously one frame worth of delta time was lost.

When the end of an animation is passed, one frame goes by so the animation has a chance to apply its final pose and fire any events on its last few frames. The second animation starts using the amount of time since the actual end of the first animation.

#154
NathanSweet 9 жил өмнө
parent
commit
2650e2679d

+ 14 - 9
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);
-			}
 		}
 	}