浏览代码

When delay is <= 0 use remaining time, not just duration.

http://www.esotericsoftware.com/forum/viewtopic.php?f=7&t=1447
NathanSweet 12 年之前
父节点
当前提交
c25809fa4f

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

@@ -202,7 +202,7 @@ public class AnimationState {
 		
 		if (delay <= 0) {
 			if (last)
-				delay += last.endTime - _data.getMix(last.animation, animation);
+				delay += Math.max(0, last.endTime - last.time) - _data.getMix(last.animation, animation);
 			else
 				delay = 0;
 		}

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

@@ -266,7 +266,9 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
 
 	if (delay <= 0) {
 		if (last) {
-			delay += last->endTime;
+			float remaining = last->endTime - last->time;
+			if (remaining < 0) remaining = 0;
+			delay += remaining;
 			if (animation) delay -= spAnimationStateData_getMix(self->data, last->animation, animation);
 		} else
 			delay = 0;

+ 1 - 1
spine-csharp/src/AnimationState.cs

@@ -214,7 +214,7 @@ namespace Spine {
 
 			if (delay <= 0) {
 				if (last != null)
-					delay += last.endTime - data.GetMix(last.animation, animation);
+					delay += Math.Max(0, last.endTime - last.time) - data.GetMix(last.animation, animation);
 				else
 					delay = 0;
 			}

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

@@ -233,7 +233,7 @@ public class AnimationState {
 
 		if (delay <= 0) {
 			if (last != null)
-				delay += last.endTime - data.getMix(last.animation, animation);
+				delay += Math.max(0, last.endTime - last.time) - data.getMix(last.animation, animation);
 			else
 				delay = 0;
 		}

+ 3 - 1
spine-lua/AnimationState.lua

@@ -201,7 +201,9 @@ function AnimationState.new (data)
 		delay = delay or 0
 		if delay <= 0 then
 			if last then
-				delay = delay + last.endTime - self.data:getMix(last.animation.name, animation.name)
+				local remaining = last.endTime - last.time
+				if remaining < 0 then remaining = 0 end
+				delay = delay + remaining - self.data:getMix(last.animation.name, animation.name)
 			else
 				delay = 0
 			end