In this blitz of a doc, we're going to show you how to integrate a Lottie animation, exported from Flow, into an iOS project.
If you don’t have an iOS project you’re already working on, then create one now. If you’ve already got a project, skip to the next section.
This step starts at 0:32
FlowLottie
Flow exports some buttery Lottie animations. So, let’s install their cocoapod.
This step starts at 0:57
New Podfile from Xcode Project
pod 'lottie-ios', '~> 3.1'
Now, let’s output some Lottie…
This step starts at 1:44
FlowLogoAnimation
timeline using the Lottie
optionAt this point you could have a look at your animation, running via Lottie, by opening the index.html file you just exported
Let’s get our animation into our project.
This step starts at 2:22
flowlogoanimation.min.json
into your Xcode projectNext, you need to add a view to your app. We’re using storyboards. If you’re using SwiftUI, or another approach, just adapt the next few steps to your needs.
This step starts at 02:39
View
to your storyboard.345 x 240
AnimationView
Lottie
Now, let’s connect everything up.
This step starts at 3:43
ViewController
animationView
viewDidLoad
instantiate the animation like this:
let animation = Animation.named("flowlogoanimation.min")
animationView.animation = animation
viewDidAppear
trigger the animation like this:
animationView.play()
So easy.
To make an animation repeat, add a variable to the constructor.
This step starts at 5:14
loopMode
to the animation view so that it looks like this:
animationView.loopMode = .repeat(.greatestFiniteMagnitude)
Sooooo easy.
result(s) found for “”.