Controlling state machine inputs
Once the Rive file is loaded and instantiated, the state machine can be queried for inputs, and these input values can be set, and in the case of triggers, fired, all programmatically.Inputs can also be set on components at runtime, see Nested
Inputs below.
Example
Inputs
The react runtime provides auseStateMachineInput hook to make the process of retrieving a state machine input much simpler than that of the basic web runtime.
Nested Inputs
You can control the inputs of Components at runtime. These inputs are not on the main artboard but on a component. To set a nested input, you need to know the path where the input exists at an artboard level.Example
Volume ComponentFX Component
Once you go more than one component deep the path will be a
/ separated
string of the unique hierarchy names.FX Component artboard, the path will be Volume Molecule/FX Component
To set the Volume input for the above example:
setNumberStateAtPath(inputName: string, value: number, path: string)setBooleanStateAtPath(inputName: string, value: boolean, path: string)fireStateAtPath(inputName: string, path: string)