Fit

sealed class Fit

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

Inheritors

Types

Link copied to clipboard
data class Contain(val alignment: Alignment = Alignment.Center) : Fit

Preserve aspect ratio and scale the artboard so that its larger dimension matches the corresponding dimension of the containing view.

Link copied to clipboard
data class Cover(val alignment: Alignment = Alignment.Center) : Fit

Preserve aspect ratio and scale the artboard so that its smaller dimension matches the corresponding dimension of the containing view.

Link copied to clipboard
object Fill : Fit

Do not preserve aspect ratio and stretch to the containing view's dimensions.

Link copied to clipboard
data class FitHeight(val alignment: Alignment = Alignment.Center) : Fit

Preserve aspect ratio and scale the artboard height to match the containing view's height.

Link copied to clipboard
data class FitWidth(val alignment: Alignment = Alignment.Center) : Fit

Preserve aspect ratio and scale the artboard width to match the containing view's width.

Link copied to clipboard
data class Layout(val scaleFactor: Float = 1.0f) : Fit

Invokes the Rive layout engine to apply responsive layout to the artboard. This assumes that the artboard was designed with layouts in mind.

Link copied to clipboard
data class None(val alignment: Alignment = Alignment.Center) : Fit

Do not scale. Use the artboard's original dimensions.

Link copied to clipboard
data class ScaleDown(val alignment: Alignment = Alignment.Center) : Fit

Preserve aspect ratio and behave like Fit.Contain when the artboard is larger than the containing view. Otherwise, use the artboard's original dimensions.

Properties

Link copied to clipboard

Default alignment. Not relevant for all fit modes, but still passed when drawing or on pointer events.

Link copied to clipboard
open val scaleFactor: Float = 1.0f

Default scale factor. Only relevant with Fit.Layout, but still passed when drawing or on pointer events.