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

http://www.esotericsoftware.com/forum/viewtopic.php?f=7&t=1447
This commit is contained in:
NathanSweet 2013-10-16 11:04:29 +02:00
parent f08d9b817c
commit c25809fa4f
5 changed files with 9 additions and 5 deletions

View File

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

View File

@ -266,7 +266,9 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
if (delay <= 0) { if (delay <= 0) {
if (last) { 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); if (animation) delay -= spAnimationStateData_getMix(self->data, last->animation, animation);
} else } else
delay = 0; delay = 0;

View File

@ -214,7 +214,7 @@ namespace Spine {
if (delay <= 0) { if (delay <= 0) {
if (last != null) 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 else
delay = 0; delay = 0;
} }

View File

@ -233,7 +233,7 @@ public class AnimationState {
if (delay <= 0) { if (delay <= 0) {
if (last != null) 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 else
delay = 0; delay = 0;
} }

View File

@ -201,7 +201,9 @@ function AnimationState.new (data)
delay = delay or 0 delay = delay or 0
if delay <= 0 then if delay <= 0 then
if last 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 else
delay = 0 delay = 0
end end