Functions and constants for interacting with Rive models
Version: stable
rive.play_anim(url,anim_id,playback,options,complete_function)
Plays the specified animation on a Rive model
PARAMETERS
url |
url |
The Rive model component for which to play an animation | ||||||||||||||||||
anim_id |
hash |
Id of the animation to play | ||||||||||||||||||
playback |
number |
Playback mode of the animation (from go.PLAYBACK_*) | ||||||||||||||||||
options |
table |
Playback options
|
||||||||||||||||||
complete_function |
function |
function to call when the animation has completed
|
rive.play_state_machine(url,state_machine_id,options,callback_function)
Plays the specified animation on a Rive model
PARAMETERS
url |
url |
The Rive model component for which to play an animation | |||||||||
state_machine_id |
hash |
Id of the state machine to play | |||||||||
options |
table |
Playback options
|
|||||||||
callback_function |
function |
function to call when a playback event occurs
|
rive.cancel(url)
Cancels all running animations on a specified spine model component
PARAMETERS
url |
url |
The Rive model component for which to cancel the animation |
rive.get_go(url,bone_id)
Returns the id of the game object that corresponds to a specified skeleton bone.
PARAMETERS
url |
url |
The Rive model component to query |
bone_id |
hash |
Id of the corresponding bone |
rive.pointer_move(url,x,y)
Forward mouse/touch movement to a component
PARAMETERS
url |
url |
The Rive model component |
x |
number |
Horizontal position |
y |
number |
Vertical position |
rive.pointer_up(url,x,y)
Forward mouse/touch release event to a component
PARAMETERS
url |
url |
The Rive model component |
x |
number |
Horizontal position |
y |
number |
Vertical position |
rive.pointer_down(url,x,y)
Forward mouse/touch press event to a component
PARAMETERS
url |
url |
The Rive model component |
x |
number |
Horizontal position |
y |
number |
Vertical position |
rive.get_text_run(url,name,nested_artboard)
Gets the text run of a specified text component from within the Rive artboard assigned to the component.
PARAMETERS
url |
url |
The Rive model component for which to get the text run from |
name |
string |
The name of the text run from the Rive artboard. |
nested_artboard |
string |
(OPTIONAL) If specified, the text run will be retrieved from the specified nested artboard |
rive.set_text_run(url,name,text_run,nested_artboard)
Set the text run of a specified text component from within the Rive artboard assigned to the component.
PARAMETERS
url |
url |
The Rive model component for which to set the text run for |
name |
string |
The name of the text run from the Rive artboard. |
text_run |
string |
The text run contents to update with. |
nested_artboard |
string |
(OPTIONAL) If specified, the text run will be set in the specified nested artboard |
rive.get_projection_matrix()
Get an orthographic projection matrix that can be used to project regular Defold components into the same coordinate space as the rive model when using the 'fullscreen' coordinate space.
PARAMETERS
None
rive.get_state_machine_input(url,name,nested_artboard)
Get the input values from a state machine input, either from the current top-level artboard, or from a nested artboard inside the Rive model artboard. Note that trigger inputs will not generate a value!
PARAMETERS
url |
url |
The Rive model component |
name |
string |
The name of the input |
nested_artboard |
string |
(OPTIONAL) If specified, the input will be queried for the specified nested artboard |
rive.set_state_machine_input(url,name,value,nested_artboard)
Set the input values from a state machine input, either from the current top-level artboard, or from a nested artboard inside the Rive model artboard. Note - To set input for a trigger, use a bool value.
PARAMETERS
url |
url |
The Rive model component |
name |
string |
The name of the input |
value |
number, bool |
The value of the input to set |
nested_artboard |
string |
(OPTIONAL) If specified, the input will be queried for the specified nested artboard |
rive.riv_swap_asset(riv_path,asset_name,options)
Replace an asset in runtime.
PARAMETERS
riv_path |
string,hash |
The Rive (.rivc) path. E.g. "/path/to/file.rivc" | ||||||
asset_name |
string |
The name of the FileAsset inside the .riv file | ||||||
options |
table |
A table of options containing
|
rive.databind.create_view_model_instance_runtime(url,name)
Creates a ViewModelInstanceRuntime
PARAMETERS
url |
url |
The Rive model component |
name |
string, hash |
The name of the view model to instantiate |
rive.databind.destroy_view_model_instance_runtime(url,handle)
Releases the previously created ViewModelInstanceRuntime
PARAMETERS
url |
url |
The Rive model component |
handle |
integer |
The handle to the ViewModelInstanceRuntime instance |
rive.databind.set_view_model_instance_runtime(url,handle)
Sets the current ViewModelInstanceRuntime
PARAMETERS
url |
url |
The Rive model component |
handle |
integer |
The handle to the ViewModelInstanceRuntime instance |
rive.databind.get_view_model_instance_runtime(url)
Gets the current ViewModelInstanceRuntime
PARAMETERS
url |
url |
The Rive model component |
rive.databind.set_properties(url,handle,properties)
Sets properties to the ViewModelInstanceRuntime instance
PARAMETERS
url |
url |
The Rive model component |
handle |
integer |
The handle to the currently set ViewModelInstanceRuntime instance |
properties |
table |
A table of properties, where each key is a Rive "path", and the values are mapped to the corresponding property value type. |