Skip to content

Commit

Permalink
Better handle clip specs when minProgress == maxProgress (#2600)
Browse files Browse the repository at this point in the history
Fixes #2586
  • Loading branch information
gpeal authored Dec 15, 2024
1 parent 43deff5 commit 89ec70c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ private class LottieAnimatableImpl : LottieAnimatable {
}
}

/**
* @return whether or not the animation should continue after this frame.
*/
private fun onFrame(iterations: Int, frameNanos: Long): Boolean {
val composition = composition ?: return true
val dNanos = if (lastFrameNanos == AnimationConstants.UnspecifiedTime) 0L else (frameNanos - lastFrameNanos)
Expand All @@ -311,7 +314,11 @@ private class LottieAnimatableImpl : LottieAnimatable {
frameSpeed < 0 -> minProgress - (progressRaw + dProgress)
else -> progressRaw + dProgress - maxProgress
}
if (progressPastEndOfIteration < 0f) {

if (minProgress == maxProgress) {
updateProgress(minProgress)
return false
} else if (progressPastEndOfIteration < 0f) {
updateProgress(progressRaw.coerceIn(minProgress, maxProgress) + dProgress)
} else {
val durationProgress = maxProgress - minProgress
Expand Down

0 comments on commit 89ec70c

Please sign in to comment.