Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import Lottie
- class SecondViewController: UIViewController {
- @IBOutlet weak var animationContainerView: UIView!
- @IBOutlet weak var olImageView: UIImageView!
- open var lottieAnimationView: AnimationView?
- override func viewDidLoad() {
- super.viewDidLoad()
- // Set an id to the OrangeLoops Image View
- olImageView.hero.id = "OrangeLoops-Logo"
- // Create and configure animation to be displayed
- setupLottieAnimationView()
- // Start animation
- lottieAnimationView?.play()
- }
- func setupLottieAnimationView() {
- // Load Lottie file into an animation view
- lottieAnimationView = AnimationView(name: "lottie-animation")
- guard let lottieAnimationView = lottieAnimationView else { return }
- lottieAnimationView.backgroundBehavior = .pauseAndRestore
- lottieAnimationView.loopMode = .loop
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment