2d-inc / Flare-Flutter

Load and get full control of your Rive files in a Flutter project using this library.
https://rive.app/
MIT License
2.55k stars 470 forks source link

How to reset model? #259

Closed mrxten closed 4 years ago

mrxten commented 4 years ago

Hi, before start another animation I need to fully reset model, is it possible?

umberto-sonnino commented 4 years ago

Are you trying to reset your Flare file to what it looks like in the 'Design' pose in the Flare editor?

Our runtimes will allow you to work with the animations in the editor, so if you want to have everything go back to 'Design' mode, you could create a placeholder animation in which you key everything at the start, and swap back to that when needed.

mrxten commented 4 years ago

I found another way. For reset animation I just reset flare widget. For that need wrap actor with some widget with unique key, and when need reset model change unique key

Container(
  key: _key,
  child: FlareActor(
    'modelAssetUri'
    controller: _controller,
  ),
);
setState(() {
  _key = UniqueKey();
});