Skip to content

Commit

Permalink
Make the onRepeat logic of the animator consistent with version 4.2 (#…
Browse files Browse the repository at this point in the history
…1393)

Co-authored-by: partyhuang <partyhuang@tencent.com>
(cherry picked from commit e7b0685)
  • Loading branch information
Hparty authored and kevingpqi123 committed Jul 11, 2023
1 parent cae58da commit 7ad020d
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/rendering/PAGAnimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,19 @@ std::vector<int> PAGAnimator::doAdvance() {
}
std::vector<int> events = {};
auto count = static_cast<int>(playTime / _duration);
if (_repeatCount > 0) {
if (count >= _repeatCount) {
// Set the playedCount to 0 to allow the animation to be played again.
playedCount = 0;
isEnded = true;
_isRunning = false;
cancelAnimation();
events.push_back(AnimationTypeUpdate);
events.push_back(AnimationTypeEnd);
} else {
if (count > playedCount) {
playedCount = count;
events.push_back(AnimationTypeRepeat);
}
events.push_back(AnimationTypeUpdate);
}
if (_repeatCount > 0 && count >= _repeatCount) {
// Set the playedCount to 0 to allow the animation to be played again.
playedCount = 0;
isEnded = true;
_isRunning = false;
cancelAnimation();
events.push_back(AnimationTypeUpdate);
events.push_back(AnimationTypeEnd);
} else {
if (count > playedCount) {
playedCount = count;
events.push_back(AnimationTypeRepeat);
}
events.push_back(AnimationTypeUpdate);
}
return events;
Expand Down

0 comments on commit 7ad020d

Please sign in to comment.