how it works
4 steps1 draw every frame
The Lottie is parametric: a ball's position is two keyframes and an ease. The importer evaluates all of it, as a Lottie renderer would (transforms, parents, precompositions, eases, opacity), at every frame, and keeps the shapes as exact paths: corners, cubic handles, rounded corners. That is the left picture below.
2 follow each path
A path that is there in every frame is a track. If its outline never changes in its own coordinates, only its matrix, it is kept once with a transform (teal below). If the outline itself moves, it is a morph of exact keys (gold). A path that never changes at all is a still.
3 keep what matters
Of a track's frames only those a straight blend cannot stand in for are kept, to a tolerance in pixels. A stretch between two kept frames is a straight blend, or a cubic-Bézier ease fitted to the frames between them, so an eased move Lottie keyed once comes back as one stretch.
4 play the scene
The result is a .tvfs scene. The player poses it at any time and draws the curves at the canvas's size, with the same engine as the editor: the right picture below, and nothing is a frame. Scenes can also be clicked and thrown, which a Lottie file has no way to say.
watch it processed
3 Lotties of our ownPick a Lottie and press process it: the importer reads the file frame by frame (the left picture is each frame as exact paths), then follows and trims the paths, and the scene starts playing on the right. The strip shows which frames it kept for each path: the fewer the ticks, the smaller the scene. Drag the frame slider to compare one frame of the Lottie with the scene at the same moment, or move the tolerance to see how much it can drop.
your own
open or drop a Lottie .jsonThe same bench on a file of yours: open a Lottie .json (Bodymovin's export, which
is what LottieFiles and After Effects write) or drop it on the panel. It is processed here, then you can scrub it,
change the tolerance, and take the .tvfs away. A .lottie file is a zip and is not read yet; unzip it and
use the .json inside.
use it
in a page, or from a shell1 in a page
Three scripts, then convert and play:
report says what it made (frames, morphs, moved,
keys) and what it left out (unsupported). tol is in the composition's
pixels; xform: false keeps every moving shape as shape keys, as before version 2.
2 from a shell
The same conversion, written to .tvfs files, with what each one cost:
player.html opens a Lottie directly too, and its address takes ?src=.
3 what it reads, and what it leaves out
Read: shape layers (paths, rectangles with their roundness, ellipses, stars; fills and strokes; groups and their transforms), solids, null layers, parenting, precompositions, opacity, eases, colours.
Named and left out: masks and mattes, effects, text, images, gradients (drawn as their middle colour), trim paths, repeaters, merged paths, expressions, 3D layers, skew, blend modes, time remapping, a stroke keyed over time, a path whose vertex count changes.
Checked against lottie-web's canvas renderer on its repository's own demos: within 0.1 to 1.5 of 255 on the files it reads whole; the benches above compare the same way, 0.0 to 0.2 on these three.
4 how big it comes out
Gzipped, against the Lottie file, on lottie-web's demos (not shipped here):
| file | Lottie | scene |
|---|---|---|
| gatin | 4.5 KB | 5.9 KB |
| adrock | 12 KB | 29 KB |
| bacon | 52 KB | 105 KB |
| happy2016 | 53 KB | 79 KB |
| bodymovin | 135 KB | 212 KB |
A scene stores the shapes where a Lottie stores the recipe, so it comes out larger; what it buys is no renderer to run, the editor's engine at any size, and scenes you can touch. The player with the curve library is about 48 KB gzipped, about the size of lottie-web's light build.