mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Fixed addAnimation when a non-looping animation trackTime is > duration.
The delay is based on `last.trackTime` because of how we preserve leftover time in update(). Previously using `addAnimation(..., 0)` on a track where the current animation has a trackTime > duration resulted in switching to the new animation, but the old animation trackTime was added to the new animation track time. See `float nextTime = current.trackLast - next.delay;` in update().
This commit is contained in:
parent
75403b9e66
commit
a961b41a9c
@ -544,12 +544,12 @@ public class AnimationState {
|
||||
float duration = last.animationEnd - last.animationStart;
|
||||
if (duration != 0) {
|
||||
if (last.loop)
|
||||
delay += duration * (1 + (int)(last.trackTime / duration));
|
||||
delay += duration * (1 + (int)(last.trackTime / duration)); // Completion of next loop.
|
||||
else
|
||||
delay += duration;
|
||||
delay += Math.max(duration, last.trackTime); // After duration, else next update.
|
||||
delay -= data.getMix(last.animation, animation);
|
||||
} else
|
||||
delay = 0;
|
||||
delay = last.trackTime; // Next update.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user