Skip to main content
A ViewModel provides access to named properties used for data binding between your application and a Rive file.

Fields

name

The name of the view model. (Coming soon)

Methods

getNumber

Returns the numeric property with the given name, or nil if not found.

getTrigger

Looks up a trigger property by name. Returns a PropertyTrigger.

getString

Looks up a string property by name. Returns a DataValueString.

getBoolean

Looks up a boolean property by name. Returns a DataValueBoolean.

getColor

Looks up a color property by name. Returns a DataValueColor.

getList

Looks up a List property by name. Returns a PropertyList.

getViewModel

Looks up a view model property by name. Returns a PropertyViewModel.

getEnum

Looks up an enum by name. Returns a PropertyEnum.

instance

Creates a new instance of the ViewModel. Pass instanceName to specify an existing instance from the file to use as template

getIndex

Returns the index. Returns -1 if view model does not have an index available.

getImage

Looks up an image by name. Returns a Property<Image>.