Constructors

Link copied to clipboard
constructor(loop: Loop = Loop.AUTO, autoplay: Boolean = true, file: File? = null, activeArtboard: Artboard? = null, onStart: OnStartCallback? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Listener
Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var file: File?
Link copied to clipboard
var fit: Fit
Link copied to clipboard

Whether this controller is active or not. If this is false, it will prevent advancing or drawing.

Link copied to clipboard
Link copied to clipboard

The scale factor to use for Fit.LAYOUT. If null, it will use a density determined by Rive (automatic). See RiveFileController.layoutScaleFactorAutomatic for more details.

Link copied to clipboard

The automatic scale factor set by Rive. This value will only be used if layoutScaleFactor is not set (null).

Link copied to clipboard
Link copied to clipboard
var loop: Loop
Link copied to clipboard
Link copied to clipboard
open val refCount: Int
Link copied to clipboard
open override var refs: AtomicInteger

The number of objects referencing this controller.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun acquire(): Int
Link copied to clipboard
Link copied to clipboard
fun advance(elapsed: Float)

Note: This is happening in the render thread: this function is synchronized with a ReentrantLock stored on the File because this is a critical section with the UI thread. When advancing or performing operations around an animations data structure, be conscious of thread safety.

Link copied to clipboard
fun autoplay()
Link copied to clipboard
fun fireState(stateMachineName: String, inputName: String, path: String? = null)
Link copied to clipboard
fun fireStateAtPath(inputName: String, path: String)
Link copied to clipboard
fun getTextRunValue(textRunName: String): String?

Get the current value for a text run named textRunName on the active artboard if it exists.

fun getTextRunValue(textRunName: String, path: String): String?

Get the text value for a text run named textRunName on the nested artboard represented at path.

Link copied to clipboard

Get the active Artboard's volume.

Link copied to clipboard
fun pause()
fun pause(animationName: String, isStateMachine: Boolean = false)
fun pause(animationNames: List<String>, areStateMachines: Boolean = false)
Link copied to clipboard
fun play(loop: Loop = Loop.AUTO, direction: Direction = Direction.AUTO, settleInitialState: Boolean = true)

Restarts paused animations if there are any. Otherwise, it starts playing the first animation (timeline or state machine) in the Artboard.

fun play(animationName: String, loop: Loop = Loop.AUTO, direction: Direction = Direction.AUTO, isStateMachine: Boolean = false, settleInitialState: Boolean = true)
fun play(animationNames: List<String>, loop: Loop = Loop.AUTO, direction: Direction = Direction.AUTO, areStateMachines: Boolean = false, settleInitialState: Boolean = true)
Link copied to clipboard
fun pointerEvent(eventType: PointerEvents, pointerID: Int, x: Float, y: Float)
Link copied to clipboard
open override fun registerListener(listener: RiveFileController.Listener)
Link copied to clipboard
open override fun release(): Int

Release a reference associated with this Controller. If refs == 0, then give up all resources and release the file.

Link copied to clipboard
Link copied to clipboard

Restore a copy of the state to this Controller.

Link copied to clipboard

Get a copy of the state of this controller and acquire a reference to the file to prevent it being released from memory.

Link copied to clipboard
fun selectArtboard(name: String? = null)

Instances the artboard with the specified name. If none is provided, it instantiates the first (i.e. default) artboard. If this controller is set to autoplay it will also start playing.

Link copied to clipboard
fun setBooleanState(stateMachineName: String, inputName: String, value: Boolean, path: String? = null)
Link copied to clipboard
fun setBooleanStateAtPath(inputName: String, value: Boolean, path: String)
Link copied to clipboard
fun setNumberState(stateMachineName: String, inputName: String, value: Float, path: String? = null)
Link copied to clipboard
fun setNumberStateAtPath(inputName: String, value: Float, path: String)
Link copied to clipboard
fun setRiveFile(file: File, artboardName: String? = null)

Assigns the file to this Controller and instances the artboard provided via artboardName. If none is provided, it instantiates the first (i.e. default) artboard. If this controller is set to autoplay it will also start playing.

Link copied to clipboard
fun setTextRunValue(textRunName: String, textValue: String)

Set the text value for a text run named textRunName to textValue on the active artboard.

fun setTextRunValue(textRunName: String, textValue: String, path: String)

Set the text value for a text run named textRunName to textValue on the nested artboard represented at path.

Link copied to clipboard
fun setVolume(value: Float)

Set the active Artboard's volume to value.

Link copied to clipboard

Named stopAnimations to avoid conflicting with stop.

fun stopAnimations(animationName: String, isStateMachine: Boolean = false)
fun stopAnimations(animationNames: List<String>, areStateMachines: Boolean = false)
Link copied to clipboard
open override fun unregisterListener(listener: RiveFileController.Listener)