swift 使用Lottie加载json动画步骤


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()//开始动画

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM