Motion and Interaction · Step 5 · 7 min read
Lottie, Rive and handing off motion
Some motion is code, some is a file. When CSS is enough, when an illustrated animation should ship as a Lottie, when it needs Rive's state machines, and how to hand off any of them with a motion spec a developer can build from without guessing.
"Make it feel like the prototype" is not a spec. A developer who gets a video has to guess the duration, the easing, the delays and what starts it, and every guess drifts a little from what you meant. A spec with numbers removes the guessing. And before you write it, there's an earlier choice: should this motion be code at all, or a file made in a motion tool and played by the app?
What you'll be able to do after reading:
- Choose between CSS, a Lottie file, a Rive file and a video for a given motion
- Explain what Lottie and Rive are, in one sentence each
- Write a motion spec with every number a developer needs
- Include the reduced-motion version in the handoff, not after it
1. Code or file?
Most interface motion, like a button press, a panel opening or a list reordering, is code: CSS or the Web Animations API, built from the components that are already there. Some motion is illustration that moves: a mascot waving, an empty state that comes alive, a success moment with confetti. Drawing that in CSS is painful and fragile, so it's made in a motion tool and shipped as a file the app plays.
| Choose | When | Watch out for |
|---|---|---|
| CSS or Web Animations | The motion moves interface elements: buttons, panels, cards, lists | Nothing extra to load; it's the default |
| Lottie | An illustrated animation that plays, loops or scrubs, the same every time | A player library to load; complex files can be heavy to render |
| Rive | An illustrated animation that reacts: states, hover, input, data | Its own runtime and editor; the team has to learn it |
| Video (MP4, WebM) | Photographic or filmed content, or effects a player can't render | Not editable, no interaction, heavier files |
2. Lottie: animation as data
Lottie is an open, JSON-based format for vector animation. It was created in 2015 by Hernan Torrisi as a way to export animations from Adobe After Effects, and it's now maintained as an open specification by the Lottie Animation Community, a non-profit project hosted by the Linux Foundation (Lottie Animation Community). Because the file describes shapes and keyframes instead of pixels, it stays sharp at any size and is usually small (LottieFiles, What is Lottie).
You can make Lottie files from After Effects with a plugin, and now from Figma: Figma Motion exports Lottie (raw JSON, one animation per file) and dotLottie (a compressed archive that can bundle images, fonts and several animations). Figma's own notes list what doesn't survive the trip: shaders, video and angular gradients aren't supported, and drop shadows, noise and glass effects don't animate (Figma Help, Export animations from Figma). Test the file in the player you'll use in production, as Figma also recommends.
Because the file is data, a developer can change its colours, play one segment of it on a tap, or tie its progress to real data, like a progress bar that follows the actual upload.
3. Rive: animation with a brain
Rive is an editor and a runtime for interactive vector animation. Its key idea is the state machine: you draw timelines, like Idle, Hover and Pressed, and connect them with transitions and conditions. The app then changes a value or passes a pointer event, and the file decides which animation plays and how it blends into the next (Rive, State machine overview).
That moves logic from the code into the file. Use Rive when the animation itself has to respond: a character that follows the cursor, a toggle illustration with three states, an onboarding that reacts to choices. If it only plays, Lottie or CSS is simpler.
4. The motion spec
| Layer | Property | From → to | Delay | Duration | Easing | Reduced motion |
|---|---|---|---|---|---|---|
| Toast card | opacity, transform | 0 → 1, translateY(16px) → 0 | 0 ms | 200 ms | ease-out | Opacity only, 200 ms |
| Check icon | transform | scale(0.6) → 1 | 100 ms | 150 ms | ease-out | No scale, appears with the card |
| Message | opacity | 0 → 1 | 100 ms | 200 ms | ease-out | Appears with the card |
| Exit, when closed | opacity | 1 → 0 | 0 ms | 150 ms | ease-in | The same |
Whatever the format, the handoff is the same: one row per layer and change, with the numbers. The spec in the figure answers every question a developer would otherwise ask:
- Trigger: what starts it. "The save request succeeds" is better than "on save", because it tells the developer to wait for the answer.
- Layer and property: what moves, and which property:
opacity,transform. Prefer those two (see Motion performance). - From and to: the start and end values, in units the code uses.
- Delay, duration, easing: in milliseconds, with the exact easing (
ease-out, or thecubic-bezier()numbers from Figma). - Reduced motion: on the same row, not in a separate note at the end.
- Interruptions: what happens if the trigger fires again mid-animation. For a toast: replace the text, don't stack another one.
Add the timeline under the table when steps overlap; a developer reads overlaps much faster from bars than from numbers. Figma Motion can also show the animation in Dev Mode, where developers scrub through it on a read-only timeline and copy code as CSS, JSON or motion.dev (Figma Help, Explore Figma Motion). Treat that code as a starting point and keep the spec as the agreement.
If your team has motion tokens, the spec uses their names instead of raw numbers: duration-short instead of 200 ms (see Motion tokens).
5. Accessibility travels with the file
Lottie and Rive animations are images that move, so they need what moving images need:
- A text alternative for what the animation means, or
aria-hiddenif it's decoration. - A pause if it plays for more than five seconds next to other content (see WCAG and motion).
- A reduced-motion version: often the animation's final frame as a still, or a short fade. The player won't decide that for you; the code that loads it has to check
prefers-reduced-motionand choose.
Put all three in the spec.
6. Common mistakes
- Handing off a video and "make it feel like this".
- Drawing interface motion in After Effects when it should be CSS on the real components.
- A Lottie with a shadow or gradient that silently breaks in export.
- Shipping a decorative animation without a still frame for reduced motion.
- A spec without the trigger, so the motion starts too early.
7. Vocabulary
| Term | Meaning |
|---|---|
| Lottie | An open JSON format for vector animation, played by a Lottie player |
| dotLottie | A compressed Lottie archive that can bundle assets and several animations |
| Rive | A tool and runtime for interactive animation, driven by state machines |
| State machine | A set of states and the transitions between them, with conditions |
| Runtime / player | The library that plays the file inside the app |
| Motion spec | The handoff document: trigger, layers, properties, values, timing, reduced version |
8. Try it (no tools needed)
- Find three animations in an app you use: one interface motion, one illustration, one that reacts to you.
- For each, decide: CSS, Lottie, Rive or video. Write one reason.
- Take the interface motion and write its spec row by row, guessing the numbers by eye.
Reflection questions: Which question would a developer ask first about your spec? Is it answered?
9. If you already practise
- Keep a spec template in the design file and in the docs, with a reduced-motion column built in.
- Agree with developers which player and version you ship, and test exports in it.
- Use the spec's names, not raw numbers, as soon as motion tokens exist.
- Review the built motion against the spec in a pairing session, at real speed.
Checklist
Learn more
- Lottie Animation Community: the open specification · LottieFiles, What is Lottie
- Figma Help, Export animations from Figma (including Lottie and dotLottie)
- Rive, State machine overview · Rive runtimes
Books, courses and videos to go deeper
- Animation at WorkRachel NaborsBook · A Book Apart, 2017 (Amazon)
- Motion design fundamentalsFigmafree, guided collection (external site)
Book links go to Amazon. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.
Related
Handoff to developers · Prototyping motion in Figma · Motion tokens · Documenting motion in a design system · Motion performance · Motion spec sheet