Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

difference in rendering between .coreAnimation and .mainThread #2060

Open
mobiletoly opened this issue May 9, 2023 · 4 comments
Open

difference in rendering between .coreAnimation and .mainThread #2060

mobiletoly opened this issue May 9, 2023 · 4 comments
Labels
bug Core Animation rendering engine Regressions introduced by the Core Animation rendering engine

Comments

@mobiletoly
Copy link

Hi
When I use

LottieConfiguration.shared.renderingEngine = .mainThread

configuration - then animation seems to be fine. But when switch to newer .coreAnimation then animation is off. Recordings and lottie JSON files are attached.

Which Version of Lottie are you using?

Lottie 4.2.0

Expected Behavior

For .coreAnimation not to mess up the animation (video is attached)

rendering-mainThread.mov

Actual Behavior

Video is attached

rendering-coreAnimation.mov

Animation JSON

data.json.zip

@calda
Copy link
Member

calda commented May 9, 2023

Are you testing with renderingEngine: .coreAnimation or renderingEngine: .automatic?

It's expected that renderingEngine: .coreAnimation will sometimes be incorrect. You should prefer using renderingEngine: .automatic, which falls back to the Main Thread rendering engine if it detects the Core Animation rendering engine doesn't support the animation.

@mobiletoly
Copy link
Author

yes, I forgot to mention that tested with .automatic as well - same wrong result.

@calda calda added the bug label May 9, 2023
@qingqingqingli
Copy link

Just wanna add to this. I'm also experiencing this issue. coreAnimation mode does not render the animation smoothly.

@calda
Copy link
Member

calda commented Aug 24, 2023

This appears to be an issue with how Core Animation itself is interpolating the transform keyframes. If we force this animation to use the expensive "manual interpolation" codepath then the legs are positioned correctly. This introduces other issues, and I'm also not sure how to detect this case dynamically (e.g. we wouldn't want to just "always" use the expensive codepath, because that would hurt performance for all other animations).

For now, using the main thread rendering engine is a good workaround.

@calda calda added the Core Animation rendering engine Regressions introduced by the Core Animation rendering engine label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Core Animation rendering engine Regressions introduced by the Core Animation rendering engine
Projects
None yet
Development

No branches or pull requests

3 participants