Package-level declarations

Types

Link copied to clipboard

Alignment of the artboard within the containing view.

Link copied to clipboard

An instantiated artboard from a RiveFile.

Link copied to clipboard
sealed class Asset<H> : AutoCloseable

Base class for assets managed by a RiveWorker.

Link copied to clipboard
class AudioAsset(handle: AudioHandle, worker: RiveWorker) : Asset<AudioHandle>

An audio asset, representing a playable sound, managed by a RiveWorker.

Link copied to clipboard

Marks APIs that use experimental hardware bitmap rendering.

Link copied to clipboard
sealed class Fit

Describes how size differences are handled between an authored Rive artboard and its containing view.

Link copied to clipboard
class FontAsset(handle: FontHandle, worker: RiveWorker) : Asset<FontHandle>

A font asset, representing a renderable typeface, managed by a RiveWorker.

Link copied to clipboard
typealias GetBitmapFun = () -> Bitmap

Function type for getting a Bitmap.

Link copied to clipboard
@RequiresApi(value = 29)
class HardwareRenderBuffer(val width: Int, val height: Int, riveWorker: RiveWorker) : CheckableAutoCloseable

GPU-backed offscreen render target for realtime canvas presentation (API 29+).

Link copied to clipboard
class ImageAsset(handle: ImageHandle, worker: RiveWorker) : Asset<ImageHandle>

An image asset, representing a renderable bitmap, managed by a RiveWorker.

Link copied to clipboard

The preferred GPU rendering backend to use.

Link copied to clipboard
class RenderBuffer(val width: Int, val height: Int, riveWorker: RiveWorker) : CheckableAutoCloseable

Deprecated software-only legacy render buffer.

Link copied to clipboard
sealed interface Result<out T>

Represents the result of an operation - typically loading - that can be in a loading, error, or success state. This includes Rive file loading. The Success result must be unwrapped to the value, e.g. through Kotlin's when/is statements.

Link copied to clipboard
@RequiresApi(value = 29)
class RiveCanvasSession(riveWorker: RiveWorker, artboard: Artboard, stateMachine: StateMachine, viewModelInstance: ViewModelInstance? = null, fit: Fit = RenderingDefaults.defaultFit(), @ColorInt clearColor: Int = RenderingDefaults.CLEAR_COLOR) : AutoCloseable

An entry point for Rive to render to a hardware accelerated Canvas using hardware bitmaps.

Link copied to clipboard
class RiveDrawToBufferException(message: String, cause: Throwable? = null) : Exception

Exceptions related to drawing to a buffer.

Link copied to clipboard

A Rive file which contains one or more artboards, state machines, and view model instances.

Link copied to clipboard
class RiveFileException(message: String, cause: Throwable? = null) : Exception

Exceptions related to Rive file handling.

Link copied to clipboard
sealed interface RiveFileSource

The source for a RiveFile.

Link copied to clipboard
sealed interface RiveFrameRate

Controls how often Rive advances and draws an active animation.

Link copied to clipboard
class RiveInitializationException(message: String, cause: Throwable? = null) : Exception

Exceptions related to Rive failing to initialize properly.

Link copied to clipboard
object RiveLog

RiveLog allows configuring logging within Rive.

Link copied to clipboard

Controls how a Rive composable participates in Compose pointer input dispatch.

Link copied to clipboard
class RiveRenderException(message: String, cause: Throwable? = null) : Exception

Exceptions related to Rive rendering.

Link copied to clipboard
class RiveShutdownException(message: String, cause: Throwable? = null) : Exception

Exceptions related to Rive failing to shut down properly.

Link copied to clipboard
class RiveView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) : FrameLayout

Note: This class is more experimental than others. It is not recommended for use at this time.

Link copied to clipboard
class SoftwareRenderBuffer(val width: Int, val height: Int, riveWorker: RiveWorker) : CheckableAutoCloseable

CPU-backed offscreen render target for snapshot-style rendering.

Link copied to clipboard

An instantiated state machine from an Artboard.

Link copied to clipboard

A view model instance for data binding which has properties that can be set and observed.

Link copied to clipboard
sealed interface ViewModelInstanceSource

The second half of a source for a ViewModelInstance. This represents the specific instance of the view model. This can be either:

Link copied to clipboard
sealed interface ViewModelSource

One half of a source for a ViewModelInstance. This represents the view model that originates the instance. This can be either Named to refer to a specific view model, or DefaultForArtboard, which will use the default view model for the given Artboard. This is usually the one the designer has intended to be used with the artboard.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun rememberArtboard(file: RiveFile, artboardName: String? = null): Artboard

Creates an Artboard from the given RiveFile.

Link copied to clipboard

Decode audio from the given bytes on the provided RiveWorker. The decoded audio can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Decode a font from the given bytes on the provided RiveWorker. The decoded font can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Decode an image from the given bytes on the provided RiveWorker. The decoded image can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Decode and register audio from the given bytes on the provided riveWorker. The decoded audio can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Decode and register a font from the given bytes on the provided RiveWorker. The decoded font can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Decode and register an image from the given bytes on the provided RiveWorker. The decoded image can only be used on the same RiveWorker it was created on.

Link copied to clipboard

Loads a RiveFile from the given source.

Link copied to clipboard
fun rememberRiveWorker(autoPoll: Boolean = true, tracingEnabled: Boolean = false, renderBackend: RenderBackend = RenderBackend.OpenGL): RiveWorker

A RiveWorker is the worker that runs Rive in a thread. It holds all of the state, including assets (images, audio, and fonts), RiveFiles, artboards, state machines, and view model instances.

Link copied to clipboard
fun rememberRiveWorkerOrNull(errorState: MutableState<Throwable?> = mutableStateOf(null), autoPoll: Boolean = true, tracingEnabled: Boolean = false, renderBackend: RenderBackend = RenderBackend.OpenGL): RiveWorker?

A nullable variant of rememberRiveWorker that returns null if the Rive worker cannot be created.

Link copied to clipboard
fun rememberStateMachine(artboard: Artboard, stateMachineName: String? = null): StateMachine

Creates a StateMachine from the given Artboard.

Link copied to clipboard
Link copied to clipboard
fun Rive(file: RiveFile, modifier: Modifier = Modifier, playing: Boolean = true, artboard: Artboard? = null, stateMachine: StateMachine? = null, viewModelInstance: ViewModelInstance? = null, fit: Fit = RenderingDefaults.defaultFit(), backgroundColor: Int = RenderingDefaults.CLEAR_COLOR, pointerInputMode: RivePointerInputMode = Consume, frameRate: RiveFrameRate = RiveFrameRate.Unbounded, onBitmapAvailable: (GetBitmapFun) -> Unit? = null)

The main composable for rendering a Rive file's artboard and state machine.