Command Palette

Search for a command to run...

State Machines

Interactive state-driven animations for dotLottie

State Machines

dotLottie supports embedded state machines that make animations interactive. Rather than playing a fixed sequence, a state machine lets an animation respond to user input — clicks, pointer events, custom signals — and transition between different playback states in response.

State machine logic is self-contained inside the .lottie file, making interactive behaviour portable across platforms without rewriting per-platform interaction code.

A state machine is built from four cooperating parts:

PartDescription
InputsNamed typed variables (numeric, string, boolean) and event signals. Guards read inputs; actions write them.
InteractionsDeclarations that bind user gestures or animation lifecycle events to actions.
StatesNamed playback configurations. The machine is always in exactly one state at a time.
TransitionsRules attached to a state that move to another state when guards pass.

State machine files are stored in the s/ directory of the .lottie archive and referenced from manifest.json:

{
  "version": "2",
  "animations": [{ "id": "button" }],
  "stateMachines": [
    { "id": "button-states", "name": "Button States" }
  ],
  "initial": { "stateMachine": "button-states" }
}

Learn More

Last updated: April 10, 2026 at 9:12 AMEdit this page