lottie-ios
lottie-ios copied to clipboard
play(fromFrame:toFrame:) doesn't work properly with CA rendering engine
Which Version of Lottie are you using?
Lottie 4.4.2
Expected Behavior
When calling play(fromFrame:toFrame:completion:), I expect Lottie to play the animation in the given frame range properly but it somehow plays the last frame at the last for some reason
Actual Behavior
It should play the last frame in the range given
Animation JSON
Cannot share
Steps to reproduce
We need to use a Lottie file with IP = 30
eg:
{"v":"5.9.0","fr":30,"ip":30,"op":210,"w":360,"h":270, .. }
Seems to occur if we use the CoreAnimation rendering engine LottieConfiguration.shared.renderingEngine = .coreAnimation
We would need to use a lottie which has two states eg:
Processing State (Frame: 0 to 100) -> This would be in autoReverse LottieLoopMode Final State (Frame: 101 - 200) -> This would be in playOnce LottieLoopMode
Now we use the following code to play from an specific frame range:
private func playAnimation(){
animationView.animationSpeed = 1
if fromFrame >= 0 {
animationView.play(fromFrame: fromFrame ,toFrame: toFrame, loopMode: loopMode) { _ in }
} else {
animationView.loopMode = loopMode
animationView.play { _ in }
}
}
For us to investigate, share a sample animation and sample code that demonstrates this issue.
This issue is stale because it is marked "can't reproduce" and has had no activity in the past week. Please comment with additional information, or this issue will be closed due to inactivity in one week.