API
API
Lua

Defold Learn logo


rive

Version: stable

FUNCTIONS
rive.pointer_move()
rive.pointer_up()
rive.pointer_down()
rive.pointer_exit()
rive.get_projection_matrix()
rive.set_file_listener()
rive.get_file()
rive.set_artboard()
rive.get_artboard()
rive.set_state_machine()
rive.get_state_machine()
rive.set_view_model_instance()
rive.get_view_model_instance()

Functions

rive.pointer_move()

rive.pointer_move(url,x,y)

Lua wrapper for pointer movement.

PARAMETERS

url url
Component receiving the pointer move.
x number
Pointer x coordinate in component space.
y number
Pointer y coordinate in component space.

rive.pointer_up()

rive.pointer_up(url,x,y)

Lua wrapper for pointer up events.

PARAMETERS

url url
Component receiving the pointer release.
x number
Pointer x coordinate.
y number
Pointer y coordinate.

rive.pointer_down()

rive.pointer_down(url,x,y)

Lua wrapper for pointer down events.

PARAMETERS

url url
Component receiving the pointer press.
x number
Pointer x coordinate.
y number
Pointer y coordinate.

rive.pointer_exit()

rive.pointer_exit(url,x,y)

Lua wrapper for pointer exit events.

PARAMETERS

url url
Component receiving the pointer leave.
x number
Pointer x coordinate.
y number
Pointer y coordinate.

rive.get_projection_matrix()

rive.get_projection_matrix()

Returns the projection matrix in render coordinates.

PARAMETERS

None


rive.set_file_listener()

rive.set_file_listener(callback)

Sets or clears the global file listener callback.

PARAMETERS

callback function(self, event, data)
nil
Callback invoked for file system events; pass nil to disable.
self object
The calling script instance.
event string
One of onFileLoaded, onFileDeleted, onFileError, onArtboardsListed, onViewModelsListed, onViewModelInstanceNamesListed, onViewModelPropertiesListed, onViewModelEnumsListed
data table
Additional fields vary by event. Common keys include
file FileHandle
File handle involved in the event.
viewModelName string
View model name for the request, when applicable.
instanceNames table
Array of instance name strings.
artboardNames table
Array of artboard name strings.
properties table
Array of property metadata tables.
enums table
Array of enum definitions.
error string
Error message when a failure occurs.

rive.get_file()

rive.get_file(url)

Returns the Rive file handle tied to the component.

PARAMETERS

url url
Component whose file handle to query.

rive.set_artboard()

rive.set_artboard(url,name)

Switches the active artboard for the component.

PARAMETERS

url url
Component using the artboard.
name string
nil
Name of the artboard to create and set. Pass nil to create a default artboard.

rive.get_artboard()

rive.get_artboard(url)

Queries the current artboard handle for the component.

PARAMETERS

url url
Component whose artboard handle to return.

rive.set_state_machine()

rive.set_state_machine(url,name)

Selects a state machine by name on the component.

PARAMETERS

url url
Component owning the state machine.
name string
nil
Name of the state machine to create and set. Pass nil to create a default state machine.

rive.get_state_machine()

rive.get_state_machine(url)

Returns the active state machine handle for the component.

PARAMETERS

url url
Component whose active state machine to query.

rive.set_view_model_instance()

rive.set_view_model_instance(url,name)

Selects a default view model instance by name.

PARAMETERS

url url
Component owning the view model instance.
name string
View model name whose default instance should be activated.

rive.get_view_model_instance()

rive.get_view_model_instance(url)

Returns the handle of the currently bound view model instance.

PARAMETERS

url url
Component whose view model instance handle to query.