Rive Animation View
This view aims to provide the most straightforward way to get Rive graphics into your application.
Simply add the view to your activity and you are good to go!
Very simple animations can be configured completely from a layout file. We also expose a thin API layer to allow more control over how animations are played.
All of this is built upon the C++ wrappers under the app.rive.runtime.kotlin.core namespace which can be used directly for the most flexibility.
Types
Tracks the renderer attributes that need to be applied to this View within its lifecycle.
Properties
Get the currently loaded animation instances.
Getter/Setter for the currently loaded artboard name. Setting a new name will load the new artboard and, depending on autoplay, play them.
The scale factor to use for Fit.LAYOUT. If null, it will use a density determined by Rive (automatic).
The automatic scale factor set by Rive. This value will only be used if layoutScaleFactor is null.
Whether multitouch is enabled. When false, only the primary pointer (index 0) will be processed; additional fingers will be ignored.
Get the currently playing animation instances.
Get the currently playing state machine instances.
Get the currently loaded state machine instances.
Whether the view should absorb touch events. By default the view will not allow any touch events to views behind it. Set to true to allow for this behavior.
Functions
Adds a RiveEventListener to get notified on RiveEvents.
Fire an SMITrigger input.
Fire an SMITrigger input.
Get the current value for a text run named textRunName on the active artboard if it exists.
Get the text value for a text run named textRunName on the nested artboard represented at path.
Pauses all playing animation instances.
Pauses any animation instances called animationName.
Pauses any animation instances with any of the provided names.
Restarts paused animations. If no animations were playing it plays the first in the File.
Plays any animation instances called animationName.
Plays any animation instances with any of the provided names.
Removes the listener.
Overrides the current asset loader. It increases the assetLoader ref count by one, but its ownership is still in the hands of the caller.
Update the state of an SMIBoolean input.
Update the state of an SMIBoolean input.
Update multiple states at once supplying one or more inputs.
Update the state of an SMINumber input.
Update the state of an SMINumber input.
Create a Rive file from a byte array and load it into the view.
Set this view to use the specified Rive file. The file must be initialized outside this scope and the caller is responsible for cleaning up its resources.
Load the resource ID as a Rive file into the view.
Set the text value for a text run named textRunName to textValue on the active artboard.
Set the text value for a text run named textRunName to textValue on the nested artboard represented at path.
Stops all animation instances.
Stops any animation instances called animationName.
Stops any animation instances with any of the provided names.