Lottie
~62kb gzippedRender After Effects animations on the web via a single JSON file.
See It in Action
Each demo plays a real designer-made Lottie file -- illustrations no amount of CSS can reproduce by hand.
Click the Pay Now button to play a designer-made success animation. The entire checkmark+confetti sequence is a single JSON file -- impossible to recreate in CSS.
What is Lottie?
Lottie is a JavaScript library that plays designer-made animations on the web. A designer creates the animation in Adobe After Effects, exports it as a single JSON file (via the Bodymovin plugin), and Lottie renders it -- identical to the original -- as SVG or canvas in the browser.
Instead of hand-coding every frame, you hand off animation work to a designer and drop their JSON into your page. The result is infinitely scalable, far smaller than video or GIF, and fully controllable from JavaScript -- you can play, pause, reverse, loop, jump to any frame, or drive the animation from scroll position.
When to Use Lottie
How Lottie Compares
Rive is the interactive successor to Lottie -- its state machines react to inputs like hover, click, or data. Lottie plays a fixed JSON file; Rive files respond to the user.
GSAP builds animations from scratch in code -- any property, any shape, any timing. Lottie plays pre-made designer files. They're complementary: GSAP animates the page, Lottie plays the illustration inside it.
CSS is perfect for simple transitions and keyframes. Lottie is for illustrations that a designer drew in After Effects -- things with tens of shapes, bezier paths, and timing curves that CSS cannot express.
Get Started with Lottie
npm install lottie-web
yarn add lottie-web
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/player/lottie.min.js"></script>
import lottie from "lottie-web";
// Play a Lottie animation inside a container element
lottie.loadAnimation({
container: document.getElementById("animation"),
renderer: "svg", // "svg" | "canvas" | "html"
loop: true,
autoplay: true,
path: "https://example.com/animation.json" // JSON exported from After Effects
});