Android uses Lottie to load JSON animation sample code

Lottie

Lottie is an open source animation project of airbnb. It supports IOS, Mac OS, Android RN. Due to the implementation of some complex animation, it often writes a lot of code to implement it, and debugging the effect of animation will take more time. Using it to solve some animations will bring great convenience.

The designer designs relevant animations in after effects, and then installs the plug-in bodymovin. This plug-in can help export JSON files of animation effects, and then we can load relevant JSON files through Lottie to achieve animation effects.

advantage

deficiencies

GitHub code portal https://github.com/18380438200/LottieAnim

First, the effect diagram is tiktok animation.

As we all know, attribute animation and gap animation can only do some simple effects, while GIF graph and frame animation can be used for complex animation, but the increase of resource space leads to the increase of APK. Loading JSON file to realize animation perfectly solves the above problems.

Designer AE exports Json files, Lotti parse Json files, and then Core Animation API rendering rendering. So let your company's UI learn AE and have more skills for self-defense.

Lottie open source library address: a woman integrating Android, IOS, react native and web platform.

https://github.com/airbnb/lottie-android

Usage:

Import and warehousing

Create the assets folder and put the JSON file in it.

Reference lottieanimationview control

Common attributes:

Common operations:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>