Home/Help/State machine/Your first flow

STATE MACHINE

Your first flow

A flow connects the timeline's states: the state the file starts in, and what takes it from one state to another. Here a switch goes On when it is clicked and Off on the next click. The canvas is the flow's live preview, so you can try it as you build it.

Do it in the editor: guided tour6 steps · about 4 minutes · opens a practice scene

Step by step

  1. Put the first state on the chart

    In the State machine workspace, drag Off from the left panel's States onto the chart. The first state makes the flow, Main, and the flow starts in it (tagged Start). Its editor opens: how it plays, its direction, what makes it leave.

  2. Add the next state

    Drag On onto the chart, to the right of Off. A state the flow doesn't use yet is greyed in the list; drag a box to move it on the chart.

  3. Connect them

    Drag from the dot at Off's right edge to On. The arrow is an interaction: what takes the flow from Off to On. It starts as When?, dashed, until you say what makes it happen.

  4. Say when

    In the interaction's editor, open When and pick Click. A pointer When also has on: anywhere, or one layer. Go to is where it leads, by a Cut or a Blend.

  5. Add the way back

    Drag from On's dot to Off and pick Click as its When, so each click turns the switch the other way.

  6. Try it

    Click the switch on the canvas. The LIVE bar says which state plays, the chart marks its box, and the right panel's What happened lists each step. ↺ starts the flow again.

Good to know. A flow is saved with the project, and the file exports with it: Export › Animated SVG › Starts › With the flow. A file can hold several flows (the left panel's Flows: + adds one); one runs at a time. Chart | List in the chart's header shows the same flow as rows. The left panel's Start from has twelve ready flows (a button, a toggle, tabs, a loader…): Use in this file adds one with its states, ready to animate, and Open the example shows it working. My flows keeps your own to use in other projects.

Keys

EscClose the editor
DelRemove what is picked
SpaceStart the preview again