animation on EACH ROW of a list/table
Using flutter, does anyone know a way to clone or instantiate multiple copies of an artboard without reloading it from disk ... reloading each time would really waste power/memory during scrolling of my list (animation on each row)
Do I need to re-load or clone the artboard for each row to keep those instances distinct from each other?? I saw in some old Flare docs about "instancing" an artboard, but can't find any current docs or methods to do so ...
Thanks!!
We're close to adding instancing of artboards to the runtime, which will let you do just this.
artboard.instance() is now available, which will: "Make an instance of the artboard, clones internal objects and properties."
Another relevant issue is: https://github.com/rive-app/rive-flutter/issues/68
That asks how to do preaching. For now, the best option would be to reuse a loaded Rive file and artboard throughout your application and pass it around as state.
Here is an example to load a Rive file:
// Load the animation file from the bundle, note that you could also
// download this. The RiveFile just expects a list of bytes.
rootBundle.load('assets/liquid_download.riv').then(
(data) async {
// Load the RiveFile from the binary data.
final file = RiveFile.import(data);
// The artboard is the root of the animation and gets drawn in the
// Rive widget.
final artboard = file.mainArtboard;
var controller =
StateMachineController.fromArtboard(artboard, 'Download');
if (controller != null) {
artboard.addController(controller);
_start = controller.findInput('Download');
_progress = controller.findInput('Progress');
}
setState(() => _riveArtboard = artboard);
},
);
Closing this, but feel free to reopen if anything is unclear or more information is needed.