View documentation, FAQ, help, examples, and more at airbnb.io/lottie
Lottie loads and renders animations and vectors exported in the bodymovin JSON format. Bodymovin JSON can be created and exported from After Effects with bodymovin, Sketch with Lottie Sketch Export, and from Haiku.
Designers can create and ship beautiful animations without an engineer painstakingly recreating them by hand. Since the animation is backed by JSON they are extremely small in size but can be large in complexity! Animations can be played, resized, looped, sped up, slowed down, reversed, and even interactively scrubbed. Lottie can play or loop just a portion of the animation as well, the possibilities are endless! Animations can even be changed at runtime in various ways! Change the color, position, or any keyframable value!
Here is just a small sampling of the power of Lottie
You can pull the Lottie Github Repo and include the
Lottie.xcodeproj to build a dynamic or static library.
Add the pod to your Podfile:
And then run:
After installing the cocoapod into your project import Lottie with
Add Lottie to your Cartfile:
github "airbnb/lottie-ios" "master"
And then run:
In your application targets “General” tab under the “Linked Frameworks and Libraries” section, drag and drop lottie-ios.framework from the Carthage/Build/iOS directory that
carthage update produced.
The Lottie SDK does not collect any data. We provide this notice to help you fill out App Privacy Details.
We always appreciate contributions from the community. To make changes to the project, you can clone the repo and open
Lottie.xcworkspace. This workspace includes:
All pull requests with new features or bug fixes that affect how animations render should include snapshot test cases that validate the included changes.
Tests/Samples. Re-run the snapshot tests to generate the new snapshot image files.
isRecording = truein
SnapshotTests.swiftand then re-run the snapshot tests.
$ sudo gem install bundle $ bundle install
For example, all Swift code should be formatted according to the Airbnb Swift Style Guide. After making changes, you can reformat the code automatically using SwiftFormat and SwiftLint by running
bundle exec rake format:swift. Other helpful commands include:
$ bundle exec rake build:all # builds all targets for all platforms $ bundle exec rake build:package:iOS # builds the Lottie package for iOS $ bundle exec rake test:package # tests the Lottie package $ bundle exec rake format:swift # reformat Swift code based on the Airbnb Swift Style Guide
|Last commit: Yesterday|
Note: Lottie 3.4.0 added a new rendering engine powered by Core Animation. Please try it out and let us know if you encounter any issues! It will be enabled by default in Lottie 4.0, which we plan on releasing later this month. More information is available in this announcement: https://github.com/airbnb/lottie-ios/discussions/1627
This version renames several public types, to resolve conflicts with types in Apple frameworks (https://github.com/airbnb/lottie-ios/issues/1420):
Lottie.Animationhas been renamed to
LottieAnimation, to resolve a conflict with
Lottie.Colorhas been renamed to
LottieColor, to resolve a conflict with
Lottie.Vector3Dhas been renamed to
LottieVector3D, to resolve a conflict with
For consistency with these new names, we have also renamed the following public types:
Lottie.AnimationViewhas been renamed to
Lottie.Vector1Dhas been renamed to
Lottie.Vector2Dhas been renamed to
For backwards compatibility Lottie 3.5.0 includes
typealiases for the old names, which map to the new names. These
typealiases are marked as deprecated and include fix-its to update call-sites to the new name.
We plan on releasing Lottie 4.0 in the next few weeks. In Lottie 4.0 we will remove the compatibility typealiases (for
Color, etc) , so code using the old names will no longer compile. This will resolve the naming conflicts with SwiftUI types. Consider updating to Lottie 3.5.0 first, applying the fix-its recommended by the deprecation warnings, and then update to Lottie 4.0 once it is released (Lottie 4.0 will no longer include deprecation warnings with fix-its). Thank you for bearing with us through this transition process!
Lottie 4.0 will also make the new Core Animation rendering engine (added in Lottie 3.4.0) the default rendering engine option. As mentioned above, please try out the new rendering engine if you haven't yet and let us know if you encounter any issues! We've been hard at work fixing issues reported by the community.
If your application has a storyboard that references
AnimationView, it may crash when using Lottie 3.5.0 (https://github.com/airbnb/lottie-ios/issues/1771). The fix for this issue is to update all references of
LottieAnimationView and update all references of
LottieAnimation. This should be resolved in Lottie 4.0, where code using the old names will no longer compile.