-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public final class Artboard implements AutoCloseable
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 rememberArtboard or Artboard.fromFile. 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 ArtboardHandleartboardHandleprivate final Stringname
-
Method Summary
Modifier and Type Method Description final ArtboardHandlegetArtboardHandle()final StringgetName()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. -
-
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.
-
-
-
-