Comments (9)
I'm seeing this as well, I was on rive: ^0.6.4 and just switched to rive: ^0.6.7, but no improvement.
from rive-flutter.
Did they used to play previously? Could either of you post a sample file/source?
from rive-flutter.
@luigi-rosso,
Here is the Rive 2 file that we were using to test with for our flutter app splash screen.
rive_splashscreen_sample.zip
Here is the code that is calling it and I have splashScreenType set to "rive" and kAnimationName set to "fmksplash" in my config file. This code works great with a Rive 1 animation or a static image/gif, but I'm just staring at a white screen for an extended period of time if it is a Rive 2 animation.
`
@OverRide
Widget build(BuildContext context) {
String splashScreenType = kSplashScreenType;
dynamic splashScreenData = kSplashScreen;
/// showing this blank page will impact to the UX
// if (appConfig == null) {
// return Center(child: Container(color: Theme.of(context).backgroundColor));
// }
if (appConfig != null && appConfig['SplashScreen'] != null) {
splashScreenType = appConfig['SplashScreen']['type'];
splashScreenData = appConfig['SplashScreen']['data'];
}
if (splashScreenType == 'rive') {
const animationName = kAnimationName;
return RiveSplashScreen(
onSuccess: checkToShowNextScreen,
asset: splashScreenData,
animationName: animationName,
);
}
if (splashScreenType == 'flare') {
return SplashScreen.navigate(
name: splashScreenData,
startAnimation: 'fluxstore',
backgroundColor: Colors.white,
next: checkToShowNextScreen,
until: () => Future.delayed(const Duration(seconds: 2)),
);
}
if (splashScreenType == 'animated') {
debugPrint('[FLARESCREEN] Animated');
return AnimatedSplash(
imagePath: splashScreenData,
next: checkToShowNextScreen,
duration: 2500,
type: AnimatedSplashType.StaticDuration,
isPushNext: true,
);
}
if (splashScreenType == 'zoomIn') {
return CustomSplash(
imagePath: splashScreenData,
backGroundColor: Colors.white,
animationEffect: 'zoom-in',
logoSize: 50,
next: checkToShowNextScreen,
duration: 2500,
);
}
if (splashScreenType == 'static') {
return StaticSplashScreen(
imagePath: splashScreenData,
onNextScreen: checkToShowNextScreen,
);
}
return Container();
}
`
from rive-flutter.
Hi @meek2100, thanks for the example. I loaded the file into our example player and it seems to play on mac, web, and iPhone. There is a condition where it'll sometimes stop on the wrong frame (it misses drawing the last frame). We're working on a fix for that but it should the animation is still technically being applied. I'll post here when that fix is live in case it's related. If a hot-restart helps, then this might be related.
In the meantime, can you provide the source for RiveSplashScreen? Even better, if you're able to, a complete full source repro would be really helpful!
from rive-flutter.
Please try rive: ^0.6.8
to see if it helps with this issue. It fixes an issue where the last frame of a one-shot animation wasn't being drawn.
from rive-flutter.
Tried 0.6.8 with no change.
Here is the source for RiveSplashScreen:
`
class RiveSplashScreen extends StatefulWidget {
final Function onSuccess;
final String asset;
final Color color;
final String animationName;
const RiveSplashScreen({
Key key,
@required this.onSuccess,
@required this.asset,
@required this.animationName,
this.color,
}) : super(key: key);
@OverRide
_RiveSplashScreenState createState() => _RiveSplashScreenState();
}
class _RiveSplashScreenState extends State {
Artboard _riveArtboard;
RiveAnimationController _controller;
@OverRide
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
rootBundle.load(widget.asset).then(
(data) async {
final file = RiveFile();
if (file.import(data)) {
final artboard = file.mainArtboard;
artboard.addController(_controller = SimpleAnimation('fluxstore'));
setState(() {
_riveArtboard = artboard;
});
_controller.isActiveChanged.addListener(() {
if (!_controller.isActive) {
Future.delayed(const Duration(seconds: 1))
.then((value) => widget.onSuccess());
}
});
}
},
);
});
}
@OverRide
void dispose() {
_controller.dispose();
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.white,
child: Center(
child: _riveArtboard == null
? const SizedBox()
: Rive(artboard: _riveArtboard),
),
);
}
}
`
from rive-flutter.
I'm facing the same problem https://github.com/meek2100 is facing. Have you found a solution ?
from rive-flutter.
I exported your Rive file in v7 format, and tried it with the latest runtime 0.7.18:
class SplashAnimation extends StatelessWidget {
const SplashAnimation({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Simple Animation'),
),
body: const Center(
child: RiveAnimation.asset(
'assets/splash.riv',
fit: BoxFit.cover,
),
),
);
}
}
Here's an example showing how to detect when the animation has completed playing:
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
class SplashAnimation extends StatefulWidget {
const SplashAnimation({Key? key}) : super(key: key);
@override
_SplashAnimationState createState() => _SplashAnimationState();
}
class _SplashAnimationState extends State<SplashAnimation> {
late RiveAnimationController _controller;
@override
void initState() {
super.initState();
_controller = SimpleAnimation('fmksplash');
_controller.isActiveChanged.addListener(_activeChanged);
}
void _activeChanged() {
if (!_controller.isActive) {
print('Animation complete');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Simple Animation'),
),
body: Center(
child: RiveAnimation.asset(
'assets/splash.riv',
fit: BoxFit.cover,
controllers: [_controller],
),
),
);
}
}
Please feel free to reopen if there are more issues or questions.
from rive-flutter.
it's not working in release mode
from rive-flutter.
Related Issues (20)
- Unable to build flutter application for linux HOT 4
- Failed build for Flutter Web WASM HOT 6
- Rive not being able to lookup init symbol on iOS HOT 2
- Enable controlling animations durations for each trigger from the Flutter side
- Codemagic Windows Build HOT 2
- Performance problem when I load a Rive Animation in my flutter app HOT 2
- Cannot start animation at desired input HOT 4
- Rive incompatible with newer NDK version? HOT 3
- RiveAnimation stopped working post upgrade to 0.13.8 HOT 2
- Problem in loading multiple asset rives. HOT 3
- Events don't fire when animation loaded from file HOT 2
- Crash - Failed to load dynamic library 'librive_text.so' HOT 17
- System Font Fallback HOT 3
- rive_common's Gradle plugin version needs to be bumped to 1.6.20 HOT 1
- this package doesn't support in flutter sdk: '>=3.3.4 <4.0.0' HOT 2
- in a flutter web project,how to import js and wasm file local not use cdn HOT 1
- Performance issues when opacity of 0 applied to RiveAnimation. HOT 1
- Constant rebuilds when rives inside a ScrollView are out of view HOT 2
- v0.13.11 is not compilable on web HOT 3
- Rive animation causes device overheating by using all the CPU power HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rive-flutter.