Carry over remaining time when playing queued animations.

http://esotericsoftware.com/forum/viewtopic.php?f=7&t=2633
This commit is contained in:
NathanSweet 2014-05-15 20:11:09 +02:00
parent df312f4d24
commit 2e266127a0
5 changed files with 10 additions and 5 deletions

View File

@ -63,7 +63,8 @@ public class AnimationState {
var next:TrackEntry = current.next; var next:TrackEntry = current.next;
if (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 { } else {
// End non-looping animation when it reaches its end time and there is no next entry. // 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); if (!current.loop && current.lastTime >= current.endTime) clearTrack(i);

View File

@ -103,7 +103,8 @@ void spAnimationState_update (spAnimationState* self, float delta) {
} }
if (current->next) { 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 { } else {
/* End non-looping animation when it reaches its end time and there is no next entry. */ /* 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); if (!current->loop && current->lastTime >= current->endTime) spAnimationState_clearTrack(self, i);

View File

@ -981,7 +981,8 @@ spine.AnimationState.prototype = {
var next = current.next; var next = current.next;
if (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 { } else {
// End non-looping animation when it reaches its end time and there is no next entry. // 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); if (!current.loop && current.lastTime >= current.endTime) this.clearTrack(i);

View File

@ -68,7 +68,8 @@ public class AnimationState {
TrackEntry next = current.next; TrackEntry next = current.next;
if (next != null) { 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 { } else {
// End non-looping animation when it reaches its end time and there is no next entry. // 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); if (!current.loop && current.lastTime >= current.endTime) clearTrack(i);

View File

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