티스토리 뷰
오늘은 Lottie를 사용해보겠습니다.
Lottie는 Json 기반의 Adobe After Effects 애니메이션을 랜더링할 수 있는 라이브러리 입니다.
사용을 위해서는 lottie-ios 라이브러리의 설치가 필요합니다.
자세한 설치법은 다음 링크에서 확인해주세요!
https://github.com/airbnb/lottie-ios
GitHub - airbnb/lottie-ios: An iOS library to natively render After Effects vector animations
An iOS library to natively render After Effects vector animations - GitHub - airbnb/lottie-ios: An iOS library to natively render After Effects vector animations
github.com
사용 방법
1. 설치가 끝난 후, import Lottie를 위에 입력합니다.
2. 로티 애니메이션 json 파일을 프로젝트에 추가 해줍니다.
3. 다음과 같이 설정해줍니다.
func setAnimation() {
let animationView = AnimationView(name: "example")
animationView.frame = view.bounds
animationView.contentMode = .scaleAspectFill
view.addSubview(animationView)
animationView.play()
animationView.loopMode = .loop
//animationView.pause()
}
- 파일 이름을 AnimationView(name:) 에 적은 후, AnimationView의 크기를 지정합니다.
- animationView.play()를 하면 애니메이션이 실행 되고, loopMode를 .loop으로 지정하면 무한 반복하게 됩니다.
- pause()를 하게 되면 애니메이션이 종료됩니다.
실행 결과
애니메이션이 잘 실행되는 것을 확인할 수 있습니다!
'iOS Programming' 카테고리의 다른 글
[iOS] Info.plist 탐구해보기 (0) | 2021.09.07 |
---|---|
[iOS] 문자열 앞 뒤 공백 제거하기 (Trim 사용해보기) (0) | 2021.08.30 |
[iOS] WKWebView 사용해보기 (0) | 2021.08.22 |
[iOS] PNG Image로 애니메이션 만들기 (0) | 2021.08.21 |
[iOS] 키보드 return키 이벤트 설정하기 (0) | 2021.08.21 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 개발대외활동
- WKUIDelegate
- swiftsoup
- PHAsset
- 프로세스간통신
- webcrawl
- optional
- returnKey
- 부캠
- 슈퍼스칼라
- PHImageRequestOptions
- 운영체제
- 개발동아리
- OS
- setBackgroundColor
- sharedmemory
- isNetworkAccessAllowed
- cs
- 프로세스
- 스냅킷
- RxSwift
- 쓰레드
- Xcode
- 멀티프로세스
- ios
- Swift
- 디프만
- URLComponents
- rxcocoa
- 스레드
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함