[TOC]

@(Tool set)

See GitHub: Lottie -ios for details


Lottie does animation, handing over professional things to professionals to truly liberate programmer productivity.

What scenarios are appropriate for Lottie?

  • Splash animation: The typical scene is the playback of APP logo animation

  • Pull up and refresh animation: all apps must have the function, using Lottie can do more simple and cool

  • Loading animation: A typical scenario is a loading animation of a network request

  • Animation: A typical scene is a blank page prompt

  • Button animation: typical scenes such as switch button, edit button, play button switch transition animation

  • Gift animation: A typical scene is the advanced animation playback of live streaming APP

  • View animated transitions (by LOTAnimationTransitionController presentViewController and dismissViewControllerAnimated transitions animation)

Problems encountered in the project

Different designs, different periods of the same design, may give the same animation material name, in this case, it is up to the developer to name these materials.

Step 1: Create a new Empty file called xxx.bundle.

Step 2: Add all the materials provided by the designer to xxx.bundle and change the name of the JSON file to XXX.json

Step 3: Load the Bundle to implement the animation

NSString* path = [[NSBundle mainBundle] pathForResource:bundleName ofType:@"bundle"];
LOTAnimationView *animation = [LOTAnimationView animationNamed:bundleName inBundle:[NSBundle bundleWithPath:path]];
Copy the code

For more information:

IOS Animation combat Lottie animation

【iOS】Airbnb open source animation library Lottie introduction and detailed examples

Lottie reads the JSON file for the animation