Hi there,
I have updated to Lottie 2.1.5, the app does not crash or anything. The problem I have is when I set the entry point on the ViewController with the animation View the animation plays every time. But, when I have the animation happen after the user has gone trough 3 different ViewControllers for onboarding the animation does not play. I am using this animation: https://www.lottiefiles.com/433-checked-done
I am on Swift 3 and xcode 8.3.3
Thanks!
Can I see the code example for how, and where, you are setting up the animation?
Sure!
Setting up the animation on viewDidLoad. The only thing I have in this VC is the animation.
Code:
` let animationView = LOTAnimationView(name:"checked_done")
animationView.frame = CGRect(x:0 , y:0 , width: self.view.frame.size.width , height: self.view.frame.size.height )
animationView.center = self.view.center
animationView.contentMode = .scaleAspectFill
self.view.addSubview(animationView)
animationView.play() { (finished) in
self.performSegue(withIdentifier: "goToProfileVC", sender: nil)
}
}
`
Animation not playing for me either I'm on XCode Version 9.1 & Swift 4
If you call play twice, it causes issues... make sure you only call once and call after viewDidLoad
bumping this. I'm also using XCode 9 and Swift 4. Animations worked when I was using Swift 3. Please help!
edit: My animation works in Swift 4, also when it's added to a root view controller. However, it is not working in any modals that are pushed onto the stack. The subview is added, the Lottie file appears, but is not animated. When I print animationView.isAnimationPlaying, I get "true".
my code:
var animationView: LOTAnimationView?
self.animationView = LOTAnimationView(name: "favourite_app_icon")
self.animationView!.loopAnimation = true
self.view.addSubview(animationView!)
animationView?.play()
print(animationView?.isAnimationPlaying)
Theres a bug that causes the animation to freeze if play is called inside of viewDidLoad.
You can move play to viewDidAppear.
I believe this bug is fixed on master. Will be releasing soon.
Hi, was this bug fixed on master? I'm on 2.5.0 Swift 4. I'm having the same issue. When I print "is playing" I get true as well. It works for some of the animations, for others it doesn't play and for others it doesn't even appear.
I'm an idiot. It's because the frames are so big that the animations were pushed off the screen 馃槅
Sometimes I can't believe how a UX library can be so complex and beautiful yet I can't even use it properly.
Most helpful comment
Theres a bug that causes the animation to freeze if
playis called inside ofviewDidLoad.You can move
playtoviewDidAppear.I believe this bug is fixed on master. Will be releasing soon.