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