rive-app / rive-flutter

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

Performance problem when I load a Rive Animation in my flutter app #396

Open Ismaelito86 opened 2 weeks ago

Ismaelito86 commented 2 weeks ago

I have a performance problem when I load a Rive Animation in my flutter app. I'm using last version of rive flutter package (0.13.7) and last version of flutter framework, I’m also using an iphone 15 pro device and when I load the animation, the cpu works at 80% and makes the device heat up, I'm already using skia as a rendering engine. This happens even without having any simple svg shape in the artboard (in the rive side), just having a timeline animation even empty is enough for get this behavior on the device. How can I fix this? Thanks a lot

HayesGordon commented 1 week ago

Hi @Ismaelito86,

Some things you can try on your side:

If you’re adding the animation to your app that has other logic/UI on screen, you might be causing Flutter to redraw all of that UI for each frame that Rive updates. You can wrap the Rive widget in a RepaintBoundary to ensure Rive doesn’t cause those other widgets to repaint.

It could be that there’s an issue with this animation file, and it’s in some strange condition that is causing the high usage—or, potentially, a bug with Skia in drawing those shapes/paths.

If you still have issues, please share an example project with us. A fresh project that has the animation, along with the code you’re using, so we can investigate the issue further.