-
- All Implemented Interfaces:
-
app.rive.core.CheckableAutoCloseable,java.lang.AutoCloseable
public final class Artboard implements CheckableAutoCloseable
An instantiated artboard from a RiveFile.
Can be queried for state machine names, and used to create a Rive composable.
Create an instance of this class using rememberArtboardResult or Artboard.create. When using the latter, make sure to call close when you are done with the artboard to release its resources.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classArtboard.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Booleanclosedprivate final ArtboardHandleartboardHandleprivate final Stringname
-
Method Summary
Modifier and Type Method Description BooleangetClosed()final ArtboardHandlegetArtboardHandle()final StringgetName()Unitclose()Closes this artboard and schedules deletion on its Rive worker. final List<String>getStateMachineNames()final UnitresizeArtboard(RiveSurface surface, Float scaleFactor)Resizes this artboard to match the dimensions of the given surface, divided by the scale factor. final UnitresetArtboardSize()Resets this artboard to its original dimensions. final UnitsetVolume(Float volume)Set this artboard's volume multiplier. final FloatgetVolume()Get this artboard's current volume multiplier. -
-
Method Detail
-
getArtboardHandle
final ArtboardHandle getArtboardHandle()
-
getStateMachineNames
final List<String> getStateMachineNames()
-
resizeArtboard
final Unit resizeArtboard(RiveSurface surface, Float scaleFactor)
Resizes this artboard to match the dimensions of the given surface, divided by the scale factor.
ℹ️ This is required when drawing with a fit type of Fit.Layout, where the artboard is expected to match the dimensions of the surface it is drawn to and layout its children within those bounds.
⚠️ In order for this to take effect, the state machine associated to this artboard must be advanced, even if just by 0.
- Parameters:
surface- The surface whose width and height will be used to resize the artboard.scaleFactor- The scale factor to apply when resizing.
-
resetArtboardSize
final Unit resetArtboardSize()
Resets this artboard to its original dimensions.
ℹ️ This should be called if the artboard was previously resized with resizeArtboard and you now want to draw with a fit type other than Fit.Layout, to restore the artboard to its original size.
⚠️ In order for this to take effect, the state machine associated to this artboard must be advanced, even if just by 0.
-
setVolume
final Unit setVolume(Float volume)
Set this artboard's volume multiplier.
This updates audio events driven by this artboard and any nested artboards that inherit its volume. The operation is queued on this artboard's RiveWorker.
- Parameters:
volume- The volume multiplier to apply.
-
-
-
-