Lottie Animation Viewer
Operator: Abdulla Al Fahad. How tools are built and checked
A Lottie animation is a JSON file, and a JSON file from a stranger or a stock site is something you would like to look at before you put it in an app. Most of what is in it is shapes, colours and keyframes. A small part can be code: Lottie lets a property carry an expression, which is a JavaScript string that the player runs.
That is the one thing this page refuses to do. Expressions are deleted when the file is opened and the player used here has no expression engine to run them with, so nothing in the file can execute, and the page tells you how many it removed.
Everything else works as you would expect: play, pause, scrub frame by frame, change speed, hide layers, swap colours, and export a GIF, a video or a folder of PNG frames.
Key features
- Lottie JSON and .lottie archives (including ones that hold several animations, with a picker), with images read from the archive by file name
- SVG renderer for sharp playback or canvas renderer for heavy files, speed from 0.25× to 3×, loop, and a frame scrubber
- Layer list with show and hide, colour palette from fills, strokes, gradients, solid layers and text colours, with a picker to recolour each
- GIF with the encoding done in a worker, WebM or MP4 video recorded at the frame rate you choose, and a ZIP of PNG frames with optional transparency
- Details panel: size, frame rate, frame range, duration, layer count including precompositions, embedded images, text layers and effects that are not rendered
- A cleaned JSON download with expressions removed and your colour changes applied
How untrusted animations are handled
A Lottie file's top level holds the version v, frame rate fr, in and out frames ip and op, size w and h, a list of layers and a list of assets. Layers are typed: shapes, solids, images, text, nulls and precompositions, which are layers that point to a list of layers in the assets. An animated property is an object whose k holds either a value or a list of keyframes, and an expression sits beside k as the string x.
A .lottie file is a ZIP that holds a manifest.json, one JSON per animation and the images they use. The page reads it with a running cap on the real unpacked size, 60 MB in all and 20 MB for one entry, whatever sizes the archive claims, and refuses more than 400 entries. Images are turned into data URIs held in the animation, so nothing is requested from a server.
Limits apply before anything is drawn: 20 MB of JSON, 2,000 declared layers counting every precomposition, 10,000 layers once repeated precompositions are expanded (a file of 9 KB can declare 42 layers and make the player build 3 million), a size of 4,096 px, up to 20,000 frames, 4 million JSON values and 200 levels of nesting. Beyond expressions, the page also removes layer ids and class names, which the player would copy into the page as ids and classes, replaces every image, footage or audio path that is not a picture stored inside the file with a blank pixel, deletes the slot and segment lists that can name other files, drops layers whose reference points to an asset that is not in the file, and strips font URLs and unusual characters from font names, which the player would write into a style element.
How it works
The page loads one of the two lottie-web 5.13.0 light builds, both MIT-licensed, which leave out the expression engine and the effects code. Playback runs in the page and the export draws frames on an offscreen canvas of exactly the size you ask for.
A GIF is built by posting each frame to a worker that quantises all the frames to one 256-colour palette. A video is recorded in real time from a canvas, one frame per tick of the chosen frame rate, so its length equals the animation's length, and nothing is saved when the recorder returns an empty file. GIF delays are whole hundredths of a second, so at 30 fps the page alternates 3 and 4 hundredths to keep the speed right. Cancel stops the worker or the recorder immediately.
A change of colour or a hidden layer rebuilds the player with the current frame kept, and the same change is what the exports use.
When this helps
- A designer receives a 90 KB animation from an unknown marketplace. The notice shows 14 expressions removed and the animation plays as a static pulse, which shows that its motion lived in the code and that it needs a rebuild before it ships.
- A design handoff arrives as one .lottie file with three animations (idle, hover, success) and five images. The picker lists the three animations from the manifest, and the images are read from the archive by file name, so the animation looks as designed with nothing fetched.
- A support team needs a GIF of a loading animation for an email. At 20 frames per second and 320 px the GIF stays under the page's frame and pixel limits and keeps the animation's own colours with a white background baked in.
Opening a file
- Drop a .json or .lottie file and read the notice: it says how many expressions were removed and whether any images pointed outside the file.
- Play it, scrub to a frame, and try the canvas renderer if playback is slow.
- Open Colours and change a swatch; every use of that colour in the file changes, keeping its transparency.
- Set the long side and frame rate in Export, and choose GIF, Video or PNG frames.
- Download the cleaned JSON if you want a copy with the expressions gone and your colours applied.
Example
A 200 × 200 px animation of 60 frames at 30 fps, with an expression on position and another on rotation, an image at a web address, and a yellow background solid
Open it, change #ffcc00 to #123456, export a GIF at 20 frames per second, 480 px long sideThe notice, then the GIF
2 expressions removed; 1 image replaced by a blank pixel; 6 colours listed
Duration 2.00 s; the GIF has 40 frames of 480 × 480 px, 9.2 million pixels, under the 40 million pixel budget
The largest GIF at that size is 173 framesLimits
Layer effects, 3D camera moves and text with a font that is not installed are not rendered the way After Effects does. The details panel counts effects, and text is drawn in a fallback font.
Animations that use expressions to move will move differently, or not at all, because the expressions are removed instead of evaluated.
A video export records in real time, so switching to another tab can leave frames at the wrong time.
- Change a brand colour in the palette and look at the preview before exporting; a colour that appears in several shapes changes in all of them at once, so a shadow that shared the colour changes too.
- Use PNG frames with transparency when the next tool can animate them, because GIF and video cannot keep partial transparency.
Common errors and how to fix them
- "The animation has … layers including precomposition layers. The limit is 2,000"
- Large exports from motion-graphics tools can repeat a precomposition many times. Simplify it in the source tool, or export a shorter cut.
- "Repeated precompositions make this animation build more than 10,000 layers"
- The file reuses a precomposition so often that the player would copy millions of layers. Flatten the nesting in the source tool; a normal file reuses a precomposition a handful of times.
- "The browser's recorder produced only … bytes"
- The video recorder returned an empty file, so none was saved. Try the other container in Video container, or use the GIF or PNG export.
- "This JSON is missing layers, w, h, fr or op"
- The file is JSON but not a Lottie animation, or it is a dotLottie manifest. Open the animation file itself.
- "That is 412 frames; a GIF is limited to 300"
- Lower the frame rate in Export. A 20-second animation at 15 fps is 300 frames.
- "The ZIP unpacks to more than 60 MB, so it was not opened"
- The archive compresses far more than a real animation would. The check counts the bytes actually unpacked, not what the archive says.
Best practices
- Keep the original file and treat the cleaned JSON as a preview aid: it cannot reproduce motion that depended on expressions.
Why expressions are removed instead of sandboxed
Running an expression correctly needs the After Effects expression environment, which Lottie only partly reimplements. A sandbox for that code would have to be as large and as hard to get right as the code it contains. Deleting it is smaller, and it makes the page's behaviour independent of what the file contains: the same file always plays the same way here, and nothing can read the page or send anything out.
The cost is fidelity for animations built on expressions. If the notice shows a non-zero count and the animation looks wrong, the file is relying on them, and the person who made it can export a version with the motion baked into keyframes.
Frequently asked questions
How does a .lottie file differ from a Lottie JSON file?
A .lottie file is a ZIP with a manifest, one or more animation JSON files and their images. It can hold several animations, which is why the page offers a picker, and it keeps images inside the file instead of pointing to them.
Why is my GIF limited to 300 frames and 40 million pixels?
The GIF encoder holds every frame in memory to build one palette. 40 million pixels is about 160 MB of frames, which is a safe size for a browser tab; the frame cap keeps the file itself from growing past what email accepts.
Can it export a transparent GIF or video?
No. GIF supports only on-or-off transparency, and the videos this page records have none because the background colour is drawn into every frame, so the colour you pick is baked in. PNG frames can keep the full alpha channel.