Note that a delay > 0 is relative to the when the previous animation started playing, not when AnimationState addAnimation
was called (ie when the previous TrackEntry trackTime
>= this TrackEntry delay
).
A delay of <= 0 is when the previous animation started + the previous animation duration - any mix duration (ie the mix finishes at (0) or before (< 0) the previous animation duration). However, if the previous entry is looping, its next loop completion is used instead of the duration.
Considering the above, do you still see a bug? If your delay is <= 0 it sounds like you found a bug. If your delay > 0 and you wait some time before calling addAnimation
, it could be that your delay is too short. You could do something like:
float delay = 0.5f;
TrackEntry entry = animState.getCurrent(0);
if (entry != null) delay += entry.getTrackTime();
animState.addAnimation(0, "run", true, delay);
This would cause "run" to start 0.5 seconds after addAnimation
is called.