rive-flutter
rive-flutter copied to clipboard
Performance issues when opacity of 0 applied to RiveAnimation.
Description
A very strange and simple bug, but it's reproducible 100% of the time. When we wrap RiveAnimation with an Opacity of 0, it causes Flutter to render endlessly. Any opacity value above 0 works fine. We tried multiple animations, and it's reproducible with each one of them. We used a community animation for this bug report.
Steps To Reproduce
Steps to reproduce the behavior:
- Flutter version: 3.23.0-0.1.pre (beta)
- Rive version: 0.13.8
- Paste the code and hot restart the app.
- Observe "Performance" tab in Flutter Dev Tools.
- When you make opacity as 1 and hot restart the app, performance ticks will stop.
The code:
class RiveBug extends StatelessWidget {
const RiveBug({super.key});
@override
Widget build(BuildContext context) {
return const SizedBox.square(
dimension: 100,
child: Opacity(
opacity: 0,
child: RiveAnimation.asset(
'assets/mode_switch.riv',
),
),
);
}
}
Source .riv
/.rev
file
Expected behavior
Performance ticks should stop if animation is not animating.
Screenshots
https://github.com/rive-app/rive-flutter/assets/57593530/98647b61-1b32-4377-b080-48e8da9eb035
Device & Versions
- Device: iPhone 11 Pro Max (real device)
- OS: iOS 17.5.1
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 3.23.0-0.1.pre, on macOS 14.5 23F79 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.90.2)
[✓] Connected device (6 available)
[✓] Network resources
• No issues found!