rive-app / rive-flutter

Flutter runtime for Rive
https://rive.app
MIT License
1.21k stars 191 forks source link

Animation don't work #57

Closed devandrefernandes closed 3 years ago

devandrefernandes commented 3 years ago

Hello!! I'm a beginner in rive...

My rive animation displays first frame, but animation doesn't start.

rootBundle.load('assets/loading.riv').then((data) async {
        final file = RiveFile();
        if (file.import(data)) {
          final artboard = file.mainArtboard;
          _controller = SimpleAnimation('idle');
          _controller.isActive = true;
          artboard.addController(_controller);
          setState(() => _riveArtboard = artboard);
        }
      },
);
Container(
        width: 140,
        height: 140,
        child: _riveArtboard == null
            ? SizedBox()
            : Rive(artboard: _riveArtboard),
);

Can anybody help me? Thanks. The riv file is attached.

devandrefernandes commented 3 years ago

Resolved.

I changed the name of the animation inside the rive editor and inserted the same name in SimpleAnimation.

It worked for me:

_controller = SimpleAnimation('loading');

Captura de tela de 2021-02-14 13-46-03

I downloaded it again, imported it into the flutter and it worked perfectly

Thanks!

devandrefernandes commented 3 years ago

Resolved.