0PricingLogin
Flutter Mobile Development · Lesson

State Machines and Input-Driven Motion

Wire Rive state machine inputs to app data for reactive, branching animations.

Why State Machines Beat Linear Animations

Traditional Rive animations play a single timeline from start to finish. A state machine is a graph of animation states connected by transitions, and those transitions fire based on inputs you control from Dart.

  • Reactive: the animation reflects live app data instead of a fixed sequence.
  • Branching: the same artboard can idle, hover, succeed, or fail depending on input values.
  • Blended: Rive interpolates between states, so you get smooth motion for free.

In this lesson you will wire a Rive state machine's inputs to your widget tree so motion follows user actions and model state.

The Three Input Types

A Rive state machine exposes exactly three input kinds, and choosing the right one is the core design decision.

  • Boolean (SMIBool): a held on/off value, e.g. isOpen or isLoading.
  • Number (SMINumber): a continuous value that can drive blend states, e.g. a 0–100 progress or a scroll offset.
  • Trigger (SMITrigger): a one-shot pulse that fires a transition once, e.g. tapSuccess. It has no persistent value.

Rule of thumb: use a Trigger for momentary events, a Boolean for state you hold, and a Number for anything continuous you want to blend.

All lessons in this course

  1. Embedding Rive Assets and Controllers
  2. State Machines and Input-Driven Motion
  3. Hero Transitions and Shared Element Motion
  4. Staggered and Choreographed AnimationControllers
← Back to Flutter Mobile Development