Skip to content

Commit

Permalink
Fix last frame being drawn for too long
Browse files Browse the repository at this point in the history
  • Loading branch information
outadoc committed Nov 3, 2024
1 parent c660a5a commit 2b50e0b
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ internal class AnimatedSkiaImage(

// We still need to wait for the last frame's duration before we start with the next repetition.
val drewLastFrame = frameIndexToDraw == codec.frameCount - 1
val lastFrameDuration = codec.framesInfo[frameIndexToDraw].safeFrameDuration
val hasLastFrameDurationElapsed = elapsedTime >= accumulatedDuration + lastFrameDuration
val hasLastFrameDurationElapsed = elapsedTime >= accumulatedDuration

if (!isAnimationComplete && drewLastFrame && hasLastFrameDurationElapsed) {
// We've reached the last frame of the current repetition, but we can still loop.
Expand Down

0 comments on commit 2b50e0b

Please sign in to comment.