Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Last active December 17, 2021 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanfengs/b410ba46d7cc9f717a5206d06ef71509 to your computer and use it in GitHub Desktop.
Save hanfengs/b410ba46d7cc9f717a5206d06ef71509 to your computer and use it in GitHub Desktop.
[Lottie相关]
// 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