File
Files are created in the Rive editor.
This object has a counterpart in C++, which implements much of its functionality. The base class's cppPointer keeps track of this relationship.
You can export .riv from the editor and use this class to load them. Files may contain multiple artboards.
If the given file cannot be loaded this will throw a RiveException. The Rive File format is evolving, and while we attempt to keep backwards (and forwards) compatibility where possible, there are times when this is not possible.
The Rive editor will always export your file in the latest runtime format.
⚠️ Important: If you create a File yourself using this constructor, you are responsible for calling release when you are done with it, otherwise it will leak memory.
Parameters
The bytes of the .riv file.
The RendererType to use when rendering this file. This defaults to Rive.defaultRendererType, which is RendererType.Rive.
An optional FileAssetLoader to use when loading external assets (images, fonts, audio) referenced by this file. If it is not provided you will not be able to load external assets.
Constructors
Types
Properties
Get the number of artboards in the file. Useful for index-based iteration.
Get the names of the artboards in the file.
Getter/Setter for the underlying C++ pointer value.
Get the first (i.e. the default) artboard in the file.
Whether this objects underlying pointer is still valid.
Public compatibility alias for fileLock.
The number of ViewModels in the file. Useful for index-based iteration.
Functions
Increments the references for this counter. Cannot be used for initialization - use refs.incrementAndGet instead.
Create a BindableArtboard by name. This is can then be bound to a ViewModelArtboardProperty.
Create the default BindableArtboard, as marked in the Rive file. This is can then be bound to a ViewModelArtboardProperty.
Get the ViewModel definition from the file.
Get the ViewModel definition from the file.