Skip to content

Commit 89ec70c

Browse files
authored
Better handle clip specs when minProgress == maxProgress (#2600)
Fixes #2586
1 parent 43deff5 commit 89ec70c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimatable.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ private class LottieAnimatableImpl : LottieAnimatable {
298298
}
299299
}
300300

301+
/**
302+
* @return whether or not the animation should continue after this frame.
303+
*/
301304
private fun onFrame(iterations: Int, frameNanos: Long): Boolean {
302305
val composition = composition ?: return true
303306
val dNanos = if (lastFrameNanos == AnimationConstants.UnspecifiedTime) 0L else (frameNanos - lastFrameNanos)
@@ -311,7 +314,11 @@ private class LottieAnimatableImpl : LottieAnimatable {
311314
frameSpeed < 0 -> minProgress - (progressRaw + dProgress)
312315
else -> progressRaw + dProgress - maxProgress
313316
}
314-
if (progressPastEndOfIteration < 0f) {
317+
318+
if (minProgress == maxProgress) {
319+
updateProgress(minProgress)
320+
return false
321+
} else if (progressPastEndOfIteration < 0f) {
315322
updateProgress(progressRaw.coerceIn(minProgress, maxProgress) + dProgress)
316323
} else {
317324
val durationProgress = maxProgress - minProgress

0 commit comments

Comments
 (0)