Skip to content

Commit

Permalink
Fixed animation state delay when not set right away.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Oct 22, 2013
1 parent 03610fc commit a9315d4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
7 changes: 3 additions & 4 deletions spine-as3/spine-as3/src/spine/animation/AnimationState.as
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ public class AnimationState {
_tracks[trackIndex] = entry;

if (delay <= 0) {
if (last) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= _data.getMix(last.animation, animation);
} else
if (last)
delay += last.endTime - _data.getMix(last.animation, animation);
else
delay = 0;
}
entry.delay = delay;
Expand Down
7 changes: 3 additions & 4 deletions spine-c/src/spine/AnimationState.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,9 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
self->tracks[trackIndex] = entry;

if (delay <= 0) {
if (last) {
if (last->time < last->endTime) delay += last->endTime - last->time;
delay -= spAnimationStateData_getMix(self->data, last->animation, animation);
} else
if (last)
delay += last->endTime - spAnimationStateData_getMix(self->data, last->animation, animation);
else
delay = 0;
}
entry->delay = delay;
Expand Down
7 changes: 3 additions & 4 deletions spine-csharp/src/AnimationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,9 @@ public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop,
tracks[trackIndex] = entry;

if (delay <= 0) {
if (last != null) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= data.GetMix(last.animation, animation);
} else
if (last != null)
delay += last.endTime - data.GetMix(last.animation, animation);
else
delay = 0;
}
entry.delay = delay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,9 @@ public TrackEntry addAnimation (int trackIndex, Animation animation, boolean loo
tracks.set(trackIndex, entry);

if (delay <= 0) {
if (last != null) {
if (last.time < last.endTime) delay += last.endTime - last.time;
delay -= data.getMix(last.animation, animation);
} else
if (last != null)
delay += last.endTime - data.getMix(last.animation, animation);
else
delay = 0;
}
entry.delay = delay;
Expand Down
3 changes: 1 addition & 2 deletions spine-lua/AnimationState.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ function AnimationState.new (data)
delay = delay or 0
if delay <= 0 then
if last then
if last.time < last.endTime then delay = delay + last.endTime - last.time end
delay = delay - self.data:getMix(last.animation.name, animation.name)
delay = delay + last.endTime - self.data:getMix(last.animation.name, animation.name)
else
delay = 0
end
Expand Down

0 comments on commit a9315d4

Please sign in to comment.