diff options
Diffstat (limited to 'src/animation/backend/animationutils_p.h')
-rw-r--r-- | src/animation/backend/animationutils_p.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h index 81a964046..0e74728c2 100644 --- a/src/animation/backend/animationutils_p.h +++ b/src/animation/backend/animationutils_p.h @@ -317,11 +317,15 @@ AnimatorEvaluationData evaluationDataForAnimator(Animator animator, inline bool isFinalFrame(double localTime, double duration, int currentLoop, - int loopCount) + int loopCount, + double playbackRate) { - return (localTime >= duration && - loopCount != 0 && - currentLoop >= loopCount - 1); + // We must be on the final loop and + // - if playing forward, localTime must be equal or above the duration + // - if playing backward, localTime must be equal or below 0 + if (playbackRate >= 0.0) + return (loopCount != 0 && currentLoop >= loopCount - 1 && localTime >= duration); + return (loopCount != 0 && currentLoop <= 0 && localTime <= 0); } inline bool isValidNormalizedTime(float t) |