Overview
RiveArtboard represents a single artboard within a Rive file. An artboard is a container for animations, state machines, and graphics. It provides methods for accessing animations, state machines, text runs, and controlling playback.
Properties
Audio volume for the artboard. Ranges from 0.0 (muted) to 1.0 (full volume).
Indicates whether the artboard has changed since the last frame (read-only).
Artboard Information
name
Returns the name of the artboard.The artboard’s name.
bounds
Returns the bounds of the artboard.The artboard’s bounds as a CGRect.
Dimensions
width
Returns the width of the artboard.The artboard’s width.
height
Returns the height of the artboard.The artboard’s height.
setWidth:
Sets the width of the artboard.The new width value.
setHeight:
Sets the height of the artboard.The new height value.
resetArtboardSize
Resets the artboard to its original size as defined in the Rive file.State Machine Inputs
getBool:path:
Retrieves a boolean input from a state machine.The name of the boolean input.
The path to the nested artboard containing the input.
The boolean input, or nil if not found.
getTrigger:path:
Retrieves a trigger input from a state machine.The name of the trigger input.
The path to the nested artboard containing the input.
The trigger input, or nil if not found.
getNumber:path:
Retrieves a number input from a state machine.The name of the number input.
The path to the nested artboard containing the input.
The number input, or nil if not found.
Animations
animationCount
Returns the number of animations in the artboard.The number of animations.
animationNames
Returns the names of all animations in the artboard.Array of animation names.
animationFromIndex:error:
Returns an animation instance by its index.Zero-based index of the animation.
Pointer to an error object that will be set if the operation fails.
The animation instance at the specified index, or nil if an error occurs.
animationFromName:error:
Returns an animation instance by its name.Name of the animation as defined in the Rive file.
Pointer to an error object that will be set if the operation fails.
The animation instance with the specified name, or nil if an error occurs.
State Machines
stateMachineCount
Returns the number of state machines in the artboard.The number of state machines.
stateMachineNames
Returns the names of all state machines in the artboard.Array of state machine names.
stateMachineFromIndex:error:
Returns a state machine instance by its index.Zero-based index of the state machine.
Pointer to an error object that will be set if the operation fails.
The state machine instance at the specified index, or nil if an error occurs.
stateMachineFromName:error:
Returns a state machine instance by its name.Name of the state machine as defined in the Rive file.
Pointer to an error object that will be set if the operation fails.
The state machine instance with the specified name, or nil if an error occurs.
defaultStateMachine
Returns the default state machine for the artboard.The default state machine instance, or nil if none exists.
Text Runs
textRun:
Retrieves a text run by name.The name of the text run.
The text run, or nil if not found.
textRun:path:
Retrieves a text run by name and path.The name of the text run.
The path to the nested artboard containing the text run.
The text run, or nil if not found.
Playback and Rendering
advanceBy:
Advances the artboard’s animation state by the specified time.The time in seconds to advance the animation.
draw:
Draws the artboard using the specified renderer.The renderer to use for drawing.
Data Binding
bindViewModelInstance:
Binds an instance of a view model to the artboard for updates. A strong reference to the instance being bound must be made if you wish to reuse instance properties or for observability. The same instance must also be bound to a state machine, if one exists.The instance of a view model to bind.