Flutter 颤振动画转换2个不同的动作
我在颤振动画方面有问题。我想把一个圆移到底部,完成后向右移动。就像字母“L” 我只把圆圈移到底部,我可以更新数据。我必须更新开始和结束之间的吐温或我必须使用2个不同的动画 是同一对象和同一类型的动画Flutter 颤振动画转换2个不同的动作,flutter,flutter-animation,Flutter,Flutter Animation,我在颤振动画方面有问题。我想把一个圆移到底部,完成后向右移动。就像字母“L” 我只把圆圈移到底部,我可以更新数据。我必须更新开始和结束之间的吐温或我必须使用2个不同的动画 是同一对象和同一类型的动画 AnimationController controller; Animation<double> animationRigth; double begin; double end; @override void initState() { controlle
AnimationController controller;
Animation<double> animationRigth;
double begin;
double end;
@override
void initState() {
controller = new AnimationController(
duration: Duration(milliseconds: 1600), vsync: this)
..addListener(() => setState(() {}));
begin = 200;
end = 500;
animationRigth = Tween(begin: begin).animate(controller);
super.initState();
}
IconButton(
onPressed: () {
animation = Tween(begin: begin, end: end).animate(controller);
controller.forward();
},
)
AnimatedBuilder(
animation: controller,
builder: (BuildContext context, Widget child) {
return Transform.translate(
offset: Offset(200, animation.value,),
child: circle());
});
}
)
AnimationController;
动画片;
双重开始;
双端;
@凌驾
void initState(){
控制器=新的AnimationController(
持续时间:持续时间(毫秒:1600),vsync:this)
..addListener(()=>setState((){}));
开始=200;
末端=500;
animationRigth=Tween(开始:开始)。设置动画(控制器);
super.initState();
}
图标按钮(
已按下:(){
动画=Tween(开始:开始,结束:结束)。动画(控制器);
controller.forward();
},
)
动画生成器(
动画:控制器,
生成器:(BuildContext上下文,小部件子项){
返回Transform.translate(
偏移量:偏移量(200,动画.value,),
child:circle());
});
}
)
请添加控制器和动画变量的详细信息,因为动画取决于此。您好,谢谢您的回答,我用控制器和变量编辑帖子