Lottie for iOS, macOS (and Android and React Native)
View documentation, FAQ, help, examples, and more at airbnb.io/lottie
Lottie is a mobile library for Android and iOS that natively renders vector based animations and art in realtime with minimal code.
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.
For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it 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! Lottie also supports native UIViewController Transitions out of the box!
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.
Swift Package Manager
// swift-tools-version:5.1 import PackageDescription let package = Package( name: "YourTestProject", platforms: [ .iOS(.v12), ], dependencies: [ .package(url: "https://github.com/airbnb/lottie-ios.git", from: "3.1.2") ], targets: [ .target(name: "YourTestProject", dependencies: ["Lottie"]) ] )
And then import wherever needed:
Adding it to an existent iOS Project via Swift Package Manager
- Using Xcode 11 go to File > Swift Packages > Add Package Dependency
- Paste the project URL: https://github.com/airbnb/lottie-ios
- Click on next and select the project target
- Don't forget to set
DEAD_CODE_STRIPPING = NOin your
Build Settings(https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564) **NOTE: For MacOS you must set the
If you have doubts, please, check the following links:
After successfully retrieved the package and added it to your project, just import
Lottie and you can get the full benefits of it.
As of 3.0 Lottie has been completely rewritten in Swift!
For Objective-C support please use Lottie 2.5.3. Alternatively an Objective-C branch exists and is still active.
The official objective c branch can be found here:
Also check out the documentation regarding it here:
The Lottie SDK does not collect any data. We provide this notice to help you fill out App Privacy Details.
You may find interesting
3.1.9 release -
- Add isAnimationPlaying to CompatibleAnimationView
- change id accessor from internal to public
- Updates to Text Rendering
- fix: empty layerID causes crash
- Rewrite Text Rendering to support Line Height + Added Font Provider
- fixed #944 Images from Assets.xcassets are not loading
- Work Around Xcode 12 Beta 1 Compilation Issues
- Add isAnimationQueued to determine if animation will start when this view is added to a window
- Changed ACL for animationView to public in AnimatedControl
3.1.8 Release -
Fixes a compile error introduced with 3.1.7 release
3.1.6 Release -
- Swift 5 (Thanks https://github.com/airbnb/lottie-ios/commits?author=thejohnlima !)
- Gradient Value Provider support (Thanks https://github.com/airbnb/lottie-ios/commits?author=enriquebk !)
- Precomp clipping fix
- Swift packages fixes
- Layout bug fix (Thanks https://github.com/airbnb/lottie-ios/commits?author=MariuszWisniewski )
- Crashing remove observer bug fix (Thanks https://github.com/airbnb/lottie-ios/commits?author=zenangst )
3.1.5 Release -
Various improvements and bug fixes.
3.1.4 Release -
This fixes a few bugs as well as adds support for animationSpeed setting on
3.1.3 Release -
- Various bug fixes
- Added new API for cropping animations at runtime
- Added new API for enabling/disabling nodes at runtime
3.1.2 Release -
- Various bug fixes
3.1.1 Release -
Minor improvements and bug fixes.
3.1.0 Swift 5 -
Adds support for swift 5.
Various bug fixes / Improvements
3.0.4 Release -
- Fixes a Bug with Animated Switch
- Various Bug Fixes
3.0.3 Release -
Added fix for content mode.
3.0.2 Release -
- Fix for crash with using AnimationView in a Storyboard
- Fixed a bug with Trim Paths
- Fixed a bug with AnimatedSwitch
- Added support for Base64 images encoded into the JSON
- Added support for setting animation to nil
- Added a fix for adding custom views to animation
- Added a fix that would cause animation to not play if play was called before the animation had moved to the window.
3.0.1 Release Swift 4.2 -
This release adds a few small bug fixes and upgrades the project to Swift 4.2
Initial Swift Release -
Lottie 3.0 Release Notes
Lottie 3.0 is a complete rewrite of Lottie in Swift 4.0! Read More Here
In addition to completely rebuilding the entire animation engine, several new features have been added.
Please Note that the Api and Class names have changed slightly. (No more LOT prefix).
- New documentation fully covers Lottie API.
- Text Rendering (No Glyphs) now supported
- Gradient Stroke now supported
- Individual Trim paths now supported
- Alpha inverted masks now supprted
- Marker support
- Skew now supported
- Fully support all UIView content modes
- New api for dynamic properties.
- Animation now fully supports
Codable. You can decode and encode JSON data.
- Animated Button component
- New more flexible ImageProvider
- Play animations in their native framerate
- Read animation progress in realtime
- Spatial Interpolation now more accurate
- Added API for getting animation properties
- Rewritten render system, fixing many bugs.
- JSON Decoding supports Default values
- JSON Coding unit testing
- Trim paths are now more accurate
- Bug fixes, bug fixes, bug fixes.
Final Objective-C Release -
Some minor bug fixes.
Please note this is the FINAL Objective-C release of Lottie. Moving forward Lottie will be in Swift.
2.5.2 Release -
-Various bug fixes from the community
-Fixed a bug that prevented a playing animation from resuming after the application was backgrounded.
2.5.1 Release -
Various bug fixes and pull requests from the community
- Fixed a bug with backgrounding the app stopping animation
2.5.0 Major Update -
Huge update to Lottie!
Adds a new API for dynamically changing animation properties at run time: Docs http://airbnb.io/lottie/ios/dynamic.html Tutotial http://airbnb.io/lottie/ios/dynamic_properties.html
Adds a new api for adding arbitrary subviews and geometry conversions: http://airbnb.io/lottie/ios/addsubviews.html
Adds support for time remapping
Several Bug fixes
NOTE: The old api for changing keyframes and adding subviews has been deprecated. Please move to the new system. The methods will be removed in a future version.
2.1.5 Release -
- Various Bug Fixes
- Xcode 8 Build Error
- Pause animation when leaving screen
- Web Thread Crash
- Animated Control Update
Lottie 2.1.4 -
Various Bug Fixes
2.1.3 Release -
Add accessibility support to LOTAnimatedControl and LOTAnimatedSwitch Add support for iOS 10 haptic feedback for LOTAnimatedSwitch Added gesture support to LOTAnimatedSwitch
2.1.2 Release -
- Add accessibility support to LOTAnimatedControl and LOTAnimatedSwitch
- Add support for iOS 10 haptic feedback for LOTAnimatedSwitch
- Added gesture support to LOTAnimatedSwitch
2.1.1 Release -
Fixed a crash with Lottie on iOS 8.1 Fixed a crash that happens on occasion with Lottie on all iOS versions.
2.1.0 Release -
- Bug fixes
- Fixed issues with adding custom subviews to a Lottie animation
- Added Convenience initializers to LOTComposition LOTCompositions can now be easily initialized and set on a pre-existing LOTAnimationView
- Added Interactive LOTAnimatedControl and LOTAnimatedSwitch New animated toggle switches and buttons! Check out the api here https://github.com/airbnb/lottie-ios#animated-controls-and-switches
2.0.6 Release -
- Fixed a crash with remove from superview
- Fixed a memory leak
- Fix for negative speed times
- Hopeful fix for animation delays
Fix for completion block crash. -
- Fixes a crash involving completion block.
- Fix some cases when play, progress, and others time controls were performing in unexpected ways
- Fix a bug with backgrounding animation
- animationProgress now updates with the animation.
2.0.4 Release -
Fixed bugs with play controls, pause, stop, progress Fixed bug with RenderGroup Node that caused various rendering errors.
V 2.0.3 -
Added full support for Linear and Radial Gradients. Addition of Image Cache Support Added Logging for Keypaths Can now set animation after initialization.
Several Bug Fixes for playing pausing.
Bug Fixes and Readme Update -
Several small bug fixes for 2.0.0