Better handle clip specs when minProgress == maxProgress (#2600)
Fixes #2586
diff --git a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimatable.kt b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimatable.kt
index 262bd98..5766e72 100644
--- a/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimatable.kt
+++ b/lottie-compose/src/main/java/com/airbnb/lottie/compose/LottieAnimatable.kt
@@ -298,6 +298,9 @@
}
}
+ /**
+ * @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)
@@ -311,7 +314,11 @@
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