-
public final class RiveKt
-
-
Method Summary
Modifier and Type Method Description final static UnitRive(RiveFile file, Modifier modifier, Boolean playing, Artboard artboard, StateMachine stateMachine, ViewModelInstance viewModelInstance, Fit fit, Integer backgroundColor, RivePointerInputMode pointerInputMode, Function1<Function0<Bitmap>, Unit> onBitmapAvailable)The main composable for rendering a Rive file's artboard and state machine. -
-
Method Detail
-
Rive
@Composable() final static Unit Rive(RiveFile file, Modifier modifier, Boolean playing, Artboard artboard, StateMachine stateMachine, ViewModelInstance viewModelInstance, Fit fit, Integer backgroundColor, RivePointerInputMode pointerInputMode, Function1<Function0<Bitmap>, Unit> onBitmapAvailable)
The main composable for rendering a Rive file's artboard and state machine.
Internally, Rive uses a TextureView to create and manage a Surface for rendering.
The composable will advance the state machine and draw the artboard on every frame while the Lifecycle is in the Lifecycle.State.RESUMED state. It will also handle pointer input events to influence the state machine, such as pointer down, move, and up events.
A Rive composable can enter a settled state, where it stops advancing the state machine. It will be restarted when influenced by other events, such as pointer input or view model instance changes.
- Parameters:
file- The RiveFile that created the artboard and state machine.modifier- The Modifier to apply to the composable.playing- Whether the state machine should advance.artboard- The Artboard to render.stateMachine- The StateMachine to use.viewModelInstance- The ViewModelInstance to bind to the state machine.fit- The Fit to use for the artboard.backgroundColor- The color to clear the surface with before drawing.pointerInputMode- Controls how pointer events are handled and consumed by Rive.onBitmapAvailable- Optional callback that is invoked when the first bitmap frame is available.
-
-
-
-