Better delay adjustment.

This commit is contained in:
NathanSweet 2013-10-17 01:13:11 +02:00
parent c25809fa4f
commit 3a1aac897c
6 changed files with 20 additions and 19 deletions

View File

@ -201,9 +201,10 @@ public class AnimationState {
_tracks[trackIndex] = entry;
if (delay <= 0) {
if (last)
delay += Math.max(0, last.endTime - last.time) - _data.getMix(last.animation, animation);
else
if (last) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= _data.getMix(last.animation, animation);
} else
delay = 0;
}
entry.delay = delay;

View File

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

View File

@ -213,9 +213,10 @@ namespace Spine {
tracks[trackIndex] = entry;
if (delay <= 0) {
if (last != null)
delay += Math.Max(0, last.endTime - last.time) - data.GetMix(last.animation, animation);
else
if (last != null) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= data.GetMix(last.animation, animation);
} else
delay = 0;
}
entry.delay = delay;

View File

@ -1109,9 +1109,10 @@ spine.AnimationState.prototype = {
this.tracks[trackIndex] = entry;
if (delay <= 0) {
if (last)
delay += last.endTime - this.data.getMix(last.animation, animation);
else
if (last) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= this.data.getMix(last.animation, animation);
} else
delay = 0;
}
entry.delay = delay;

View File

@ -232,9 +232,10 @@ public class AnimationState {
tracks.set(trackIndex, entry);
if (delay <= 0) {
if (last != null)
delay += Math.max(0, last.endTime - last.time) - data.getMix(last.animation, animation);
else
if (last != null) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= data.getMix(last.animation, animation);
} else
delay = 0;
}
entry.delay = delay;

View File

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