Browse Source

Carry over remaining time when playing queued animations.

http://esotericsoftware.com/forum/viewtopic.php?f=7&t=2633
NathanSweet 11 năm trước cách đây
mục cha
commit
2e266127a0

+ 2 - 1
spine-as3/spine-as3/src/spine/animation/AnimationState.as

@@ -63,7 +63,8 @@ public class AnimationState {
 
 			var next:TrackEntry = current.next;
 			if (next) {
-				if (current.lastTime >= next.delay) setCurrent(i, next);
+				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);

+ 2 - 1
spine-c/src/spine/AnimationState.c

@@ -103,7 +103,8 @@ void spAnimationState_update (spAnimationState* self, float delta) {
 		}
 
 		if (current->next) {
-			if (current->lastTime >= current->next->delay) _spAnimationState_setCurrent(self, i, current->next);
+			current->next->time = current->lastTime - current->next->delay;
+			if (current->next->time >= 0) _spAnimationState_setCurrent(self, i, current->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) spAnimationState_clearTrack(self, i);

+ 2 - 1
spine-js/spine.js

@@ -981,7 +981,8 @@ spine.AnimationState.prototype = {
 
 			var next = current.next;
 			if (next) {
-				if (current.lastTime >= next.delay) this.setCurrent(i, next);
+				next.time = current.lastTime - next.delay;
+				if (next.time >= 0) this.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) this.clearTrack(i);

+ 2 - 1
spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java

@@ -68,7 +68,8 @@ public class AnimationState {
 
 			TrackEntry next = current.next;
 			if (next != null) {
-				if (current.lastTime >= next.delay) setCurrent(i, next);
+				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);

+ 2 - 1
spine-lua/AnimationState.lua

@@ -84,7 +84,8 @@ function AnimationState.new (data)
 
 				local next = current.next
 				if next then
-					if current.lastTime >= next.delay then setCurrent(i, next) end
+					next.time = current.lastTime - next.delay
+					if next.time >= 0 then setCurrent(i, next) end
 				else
 					-- End non-looping animation when it reaches its end time and there is no next entry.
 					if not current.loop and current.lastTime >= current.endTime then self:clearTrack(i) end