스위프트에서 특별한 움직이는 애니메이션 효과를 주려면 어떻게 하면 좋을까?
GIF로 해야하나..?
이럴 때 도움이 될만한 라이브러리가 있다.
바로 Lottie
github.com/airbnb/lottie-ios
airbnb/lottie-ios
An iOS library to natively render After Effects vector animations - airbnb/lottie-ios
github.com
Json 데이터를 받아서 실행 시켜줄 수 있는데 오늘은 이것을 한번 해볼 것이다.
코코아팟으로 설치를 해줍니다.
pod 'lottie-ios'
그리고 필요한 json 파일을
Free Lottie Animation Files, Tools & Plugins - LottieFiles
The world’s largest online platform for the world’s smallest animation format for designers, developers, and more. Access Lottie animation tools and plugins for Android, iOS, and Web.
lottiefiles.com
이쪽에서 찾아서 받아준다.
어느정도는 커스텀이 가능하다!!!
override func viewDidLoad() {
super.viewDidLoad()
let test = AnimationView(name: "white")
self.view.addSubview(test)
test.frame = test.superview!.bounds
test.contentMode = .scaleAspectFit
test.play()
test.loopMode = .loop
}
위와 같이 애니메이션뷰를 생성하고 특정 시점에 플레이 시작해주면된다.
다음엔 이 기능을 추가해봐야겠다 ㅎㅎㅎ
'개발 > 개발' 카테고리의 다른 글
[WWDC] - WWDC 2021 주요 변경 부분 정리 요약! (0) | 2021.06.15 |
---|---|
[iOS] - Realm 사용해보자 - Realm 메뉴얼 (0) | 2021.05.23 |
[iOS] - Xcode Code Coverage 정복하기 (0) | 2021.04.03 |
iOS - 레이아웃 사이클 및 드로잉 사이클 (0) | 2021.03.29 |
[iOS] - 프로젝트에 SwiftLint 적용 시키기 (0) | 2021.03.21 |