1.  pod 导入Lottie框架

2、在需要的地方import Lottie

3.初始化

letstarView = AnimationView(name: "json名称,不要.json后缀")//先将json动效放到项目中

 

4.加载动画

        self.view.addSubview(starView)

        starView.snp.makeConstraints { (make) in

            make.size.equalTo(CGSize.init(width: 150, height: 150))

            make.top.equalTo(swipeableView.snp.top).offset(120)

            make.right.equalTo(swipeableView.snp.right).offset(-60)

        }

        starView.loopMode = .playOnce//循环次数

        

5.执行动画

  niceView.play()//开始动画

 

 

相关文章:

  • 2021-04-02
  • 2021-08-29
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-28
  • 2021-05-10
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
相关资源
相似解决方案