Skip to content

Commit

Permalink
[libgdx] AnimationState, improved triggering complete event.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Mar 20, 2024
1 parent 94d8a3a commit 88b009c
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,14 @@ private void queueEvents (TrackEntry entry, float animationTime) {

// Queue complete if completed a loop iteration or the animation.
boolean complete;
if (entry.loop)
complete = duration == 0 || trackLastWrapped > entry.trackTime % duration;
else
if (entry.loop) {
if (duration == 0)
complete = true;
else {
int cycles = (int)(entry.trackTime / duration);
complete = cycles > 0 && cycles > (int)(entry.trackLast / duration);
}
} else
complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
if (complete) queue.complete(entry);

Expand Down

1 comment on commit 88b009c

@NathanSweet
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #2472.

Please sign in to comment.