Hello I tried to implement flare animation with slider in flutter. I create five key ( 1, 2, 3 ,4,5) who call specific flare animation who work great on flare editor, but when I launch the app I have trouble with some item of the animation who add offset or disepear, or appear, it's random...
I create a simple test with different shapes create with different tools of the flare editor circle ,hexagone, pen, and I currently a have trouble with shape create with pen tool, who deaspear or appear randomly.
flare version : flare_flutter: ^1.5.2
chronology of the gif
value=0.0 black shape is showed // all is good
value=25.0 black shape is showed // all is good
value=0.0 black shape disepear // not good
value=25.0 black shape disepear // not good
value=0.0 black shape disepear // not good
value=25.0 black shape disepear // not good
reload app
value=0.0 black shape is showed // all is good
value=25.0 black shape is showed // all is good
here is the example
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final FlareControls controls = FlareControls();
double slidervalue;
@override
void initState() {
slidervalue=0.0;
controls.play("1");
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Container (
width:150,
height: 150,
child :new FlareActor("assets/flare_test.flr", alignment:Alignment.center, fit:BoxFit.contain, animation:"idle" , controller:controls,
)
),
Slider(
value: slidervalue,
min: 0,
max: 100,
divisions: 4,
label: "$slidervalue",
onChanged: (value) {
setState(() {
slidervalue = value;
if(slidervalue==0.0){
controls.play("1");
}
if(slidervalue==25){
controls.play("2");
}
if(slidervalue==50){
controls.play("3");
}
if(slidervalue==75){
controls.play("4");
}
if (slidervalue==100){
controls.play("5");
}
});
},
),
],
),
)
);
}
}
Here is an other observation with modification of the init origin if I interrupt animation with change state. I observe an offset of init origin in reference of the last position animation.. instead of restart the init origin
In this example I don't know why translation use last origin of rotation while rotation keep init origin on press.
In this last example why all is good the first time I press button, and the second time I loose translation axis ?
I post the issue in flare, but possibly I did thing wrong