Skip to content

Every building block ​

Everything the Studio can put into a state machine or a theme, and what the dotLottie player does with it. Each row names the example that shows it. Every behaviour was played in dotlottie-web 0.80 on files the panel wrote.

Examples: the templates, the music player, the thermostat, Themes lab.

Starting points ​

What you getShown in
BlankOne state; build the rest yourself.Music player
Toggle, Hover, Click → segment, Number → segment, Sequence, Idle → action → Idle, Intro → loop, Hover + click, Button, Loading → done, Carousel, Toggle with two segmentsA finished machine for one common pattern.All templates, one page each

States ​

SettingWhat it doesShown in
plays somethingPlays a segment (a marker) or the whole animation.every example
plays nothing — wait on a frameParks the playhead on a frame and plays nothing. Timers keep running.Thermostat: the dial
Waits instead of playingParks on the segment instead of playing it: where the playhead already is inside it, otherwise on its first frame.Hover + click: rest and sent
Listener (only listens)Plays nothing. Its rules apply from every state. A machine can have one.Music player, Thermostat
Start hereThe state the machine starts in.Music player
Direction: forwards / backwardsBackwards plays the segment from its end to its start. It reports finishing only some of the time (measured), so don't make anything wait for it. Two states on the same segment, one each way, carry the playhead on.Hold to confirm
Direction: there and backForwards, then back. Never reports finishing, so nothing may wait for it: use it for loops such as a hover. The Studio flags a when it finishes rule on it.Music player
Repeat: once / for everFor ever loops the segment.Music player
Speed2 plays twice as fast.Thermostat
BackgroundA colour painted behind the animation while the state runs, cleared when it leaves.Thermostat: the canvas glows while boosting
Ends the machineThe machine stays in this state for good: no rule leaves it. The page can start the machine again.Thermostat

When a rule fires ​

TriggerWhat it doesShown in
click (on a layer, or anywhere)Pressed and released over the target.Music player
pointer downThe moment the button goes down.Thermostat
pointer upThe moment it is released over the target. For press-and-hold, use it on the whole canvas.Thermostat
pointer enter / pointer exitThe pointer comes onto / leaves the target.Hover, Music player
pointer moveAny movement over the animation; the whole canvas only.Thermostat
it finishes / it finishes one loopThe state's segment played out / one pass of a loop.Sequence, Thermostat
another step finishesA rule on the listener that waits for a different state to finish.Thermostat: the listener waits for wakeup
a number of seconds passesAfter N seconds, or when the clock passes a time stored in an input.Carousel, Thermostat
an input changesAn input reaches a value, or an event fires. Set by your page, or by the machine itself.Number → segment, Music player
straight awayA rule with nothing to wait for: the state is left the moment it is entered. With conditions, it picks where to go — a routing state.Music player: start, track-1…3, ended

A layer click is caught anywhere in the layer's box: a layer that encloses a button also catches its clicks. Two interactions on the same layer both run.

Conditions ​

All conditions on a rule must be true together.

CompareWorks onShown in
is, is notnumbers, text, true/falseThermostat
…another input ($name)compare with an input instead of a valueMusic player: track is not $prev; Thermostat: temp is not $shown
is more than, is at leastnumbersThermostat, Music player
is less than, is at mostnumbersThermostat
fireseventsMusic player

Transitions ​

What it doesShown in
cut to itJumps straight to the next state's first frame.every example
blend into it (over N s)Plays the timeline from the current frame to the next state's first frame in that time — not a cross-fade.Music player: Stop rewinds; its preview settles back
back to the same stateEnters again and runs the entering actions again.Thermostat

Actions ​

Actions run when something happens (Advanced → Interactions), or on a state: entering, leaving (whenever one of its own rules takes the machine out of it; not when the listener does), when it finishes, on every loop. In an interaction the player checks the rules after each action, so order them so that every step is safe. See the thermostat's timer.

ActionWhat it doesShown in
Set a number / boolean / stringWrites a value. A number may be @elapsedTime (the clock) or $name (another input).Thermostat
Toggle a booleanFlips true/false.Toggle, Music player
Fire an eventSignals once; a rule waiting on it goes through.Music player
Reset an inputBack to the value it was declared with. (Not on the first state's entering when the machine is restarted — use Set there.)Thermostat
Increment / DecrementAdds / subtracts — 1 unless you type another number.Music player
Multiply, FloorScales; rounds down.Thermostat
Clamp to a rangeKeeps a number between min and max.Thermostat (+ and − stay within 16–28)
Set a random numberAnything from min to max; Floor it for a whole number.Music player
Jump to a frameMoves the playhead to frame N — or to $name, an input's value. With wait on a frame, the state stays there. While the state plays a segment, only a frame inside that segment sticks.Thermostat: the dial
Jump to progressMoves the playhead to a percentage of the whole animation: 50 is half way. Takes $name too.State machines → page recipes
Switch themeRepaints with a theme. From a state or straight from a click. On a parked state it shows only when the frame changes (why).Music player, Thermostat
Open a URLOpens a link. The page must allow the address (openUrlPolicy).Music player
Fire a custom eventTells your page something (stateMachineCustomEvent).Music player, Thermostat

Themes ​

What it doesShown in
Colour tokenRe-colours fills and strokes.Themes by example
Number tokenOpacity, rotation, fill opacity…Themes lab
Position, Scale tokensMove or resize a layer.Themes lab, Thermostat
Animated token: follow / Capture / freezePlay the comp's animation, the theme's own keys, or one still value.Themes lab, Thermostat
Several themes switched by the machineSwitch theme per track, or per mode button.Music player, Thermostat
Not a tokenShape geometry, trim, repeater, anchor point (the file would draw nothing), and stroke width (a theme drops the stroke).Themes lab

Files and pages ​

Shown in
Several machines in one file; the page picks one with stateMachineLoad(id).Music player
Driving inputs from the page: stateMachineSet…Input, stateMachineFireEvent.Music player, Number → segment
Listening: custom events, input changes (stateMachineNumericInputValueChange).Thermostat
Starting again after a machine ended: stateMachineStart().Thermostat
Sending pointer events from code: stateMachinePostClickEvent(x, y) (canvas pixels).State machines → From a web page
Reading the state: stateMachineGetCurrentState(), event stateMachineStateEntered.State machines → From a web page
Themes and slots from code: setTheme, resetTheme, setColorSlot, setScalarSlot.Slots and themes → From a web page

Traps ​

  • There and back never reports finishing, so nothing may wait for it. Back and there was measured playing forwards once and finishing, so it does not do what its name says; use Backwards or There and back instead.
  • A layer click counts anywhere in the layer's box.
  • Actions in an interaction are checked one by one.
  • More: How the player behaves.

AXO for After Effects