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:
You may find interesting
3.1.8 Release - 2020-04-23 17:30:54
Fixes a compile error introduced with 3.1.7 release
3.1.6 Release - 2020-01-27 16:11:13
- 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 - 2019-11-04 22:02:59
Various improvements and bug fixes.
3.1.4 Release - 2019-11-01 22:14:21
This fixes a few bugs as well as adds support for animationSpeed setting on
3.1.3 Release - 2019-09-13 20:43:54
- Various bug fixes
- Added new API for cropping animations at runtime
- Added new API for enabling/disabling nodes at runtime
3.1.2 Release - 2019-09-13 20:37:58
- Various bug fixes
3.1.1 Release - 2019-07-01 18:00:11
Minor improvements and bug fixes.
3.1.0 Swift 5 - 2019-05-29 19:42:07
Adds support for swift 5.
3.0.7 - 2019-05-29 18:18:29
Various bug fixes / Improvements
3.0.4 Release - 2019-04-09 18:43:40
- Fixes a Bug with Animated Switch
- Various Bug Fixes
3.0.3 Release - 2019-03-22 13:17:04
Added fix for content mode.
3.0.2 Release - 2019-03-21 19:32:03
- 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 - 2019-03-20 16:33:54
This release adds a few small bug fixes and upgrades the project to Swift 4.2
Initial Swift Release - 2019-03-17 15:44:50
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 - 2019-03-06 21:16:47
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 - 2018-10-04 22:55:19
-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 - 2018-10-04 22:44:30
Various bug fixes and pull requests from the community
- Fixed a bug with backgrounding the app stopping animation
2.5.0 Major Update - 2018-01-23 21:51:11
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 - 2017-11-30 23:54:49
- Various Bug Fixes
- Xcode 8 Build Error
- Pause animation when leaving screen
- Web Thread Crash
- Animated Control Update
Lottie 2.1.4 - 2017-10-30 22:23:17
Various Bug Fixes
2.1.3 Release - 2017-08-30 01:57:14
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 - 2017-08-30 01:38:01
- 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 - 2017-08-29 22:49:32
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 - 2017-08-28 22:29:53
- 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 - 2017-08-23 18:48:34
- 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. - 2017-08-15 19:29:36
- 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 - 2017-08-15 00:09:25
Fixed bugs with play controls, pause, stop, progress Fixed bug with RenderGroup Node that caused various rendering errors.
V 2.0.3 - 2017-08-04 23:16:01
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 - 2017-08-03 23:38:22
Several small bug fixes for 2.0.0