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 4, 2024
1 parent 6e76be2 commit a9aa4d9
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 a9aa4d9

Please sign in to comment.