Last active
December 17, 2021 07:17
-
-
Save hanfengs/b410ba46d7cc9f717a5206d06ef71509 to your computer and use it in GitHub Desktop.
[Lottie相关]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://juejin.cn/post/6844904007769522183 | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
lottieView.frame = CGRect(x: 0, y: 0, width: 400, height: 400) | |
lottieView.center = self.view.center | |
lottieView.animation = Animation.named(“lottieJson“)//绑定Lottie动画 | |
lottieView.loopMode = .loop//动画效果 执行单次、多次 | |
lottieView.contentMode = .scaleAspectFit | |
lottieView.backgroundBehavior = .pauseAndRestore//设置进入后台是否暂停动画 | |
self.view.addSubview(lottieView) | |
lottieView.play()//开始动画 | |
lottieView.stop()//暂停动画 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment