commit | a0bf926fda3f4111dbc2ff24d62c5d763f8c6d41 | [log] [tgz] |
---|---|---|
author | Gabriel Peal <gpeal@users.noreply.github.com> | Mon May 08 18:26:19 2023 -0700 |
committer | GitHub <noreply@github.com> | Mon May 08 18:26:19 2023 -0700 |
tree | 30619ff5b7a3649fb710ee7a1d5136211244e955 | |
parent | 93331f8b519ebb8a2fdcacc56f52d5a51f3d62c3 [diff] |
[Async Updates] First MVP of Async Updates (#2276) This is the first MVP of async updates. This project is being funded by Airbnb Eng and likely wouldn't happen without their sponsorship. The docs for the AsyncUpdates enum includes details on what is going on here but at a high level, Lottie has two hot paths: 1. setProgress 2. draw This allows the former to happen off of them main thread _ immediately after_ draw completes so it is ready before the next one starts. In many of my tests, the two paths were each accountable for ~50% of the total main thread work so this could reduce the main thread activity by ~50% or more. Here is an example of systrace before: <img width="1258" alt="CleanShot 2023-04-09 at 15 24 34@2x" src="https://user-images.githubusercontent.com/1307745/230800026-d73bf779-a109-46ee-9396-a54753860be4.png"> You can see setProgress being called immediately before draw. This is what it looks like with async updates enabled: <img width="1258" alt="CleanShot 2023-04-09 at 15 23 35@2x" src="https://user-images.githubusercontent.com/1307745/230800035-c6a2e02a-f47e-4cac-9394-4239ae27c524.png"> You can see that draw happens first and then setProgress for the _next frame_ happens immediately after on a different thread. This is experimental and defaults to AUTOMATIC but AUTOMATIC will default to false until this API is stabilized.
Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile!
For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand. They say a picture is worth 1,000 words so here are 13,000:
Lottie is maintained and improved on nights and weekends. If you use Lottie in your app, please consider sponsoring it to help ensure that we can continue to improve the project we love. Click the sponsor button above to learn more
Gradle is the only supported build configuration, so just add the dependency to your project build.gradle
file:
dependencies { implementation 'com.airbnb.android:lottie:$lottieVersion' }
The latest Lottie version is:
The latest stable Lottie-Compose version is: Click here for more information on Lottie-Compose.
Lottie 2.8.0 and above only supports projects that have been migrated to androidx. For more information, read Google's migration guide.
Because development has started for Lottie Compose, Gradle, and the Android Gradle Plugin will be kept up to date with the latest canaries. This also requires you to use Android Studio Canary builds. Preview builds can be installed side by side with stable versions.