State Machines
(Runtime) Rive’s state machines provide a way to combine a set of animations and manage the transition between them through a series of inputs that can be programmatically controlled.
State Machines
(Editor) State Machines are a visual way to connect animations together and define the logic that drives the transitions.
Overview
A StateMachine contains Inputs and Events and advances (plays) an animation.A Rive Widget automatically loads and advances the state machine from your artboard configuration settings. Here’s how you can access the loaded state machine in your scripts:**
Accessing Inputs
There are three input types, each extendsSMIInput
(State Machine Input):
SMIBool
contains a.Value
property, a boolean that can be set to true or false.SMITrigger
is a boolean that is set to true for one frame by calling the.Fire()
method.SMINumber
contains a.Value
property, a float that can be set to any value.
Access by name
Retrieve a state machine input by name and type. Trigger:Access by index
Get the input count (length) and retrieve by index:Access all inputs
Retrieve a list of allSMIInputs
: