【发布时间】:2019-12-23 14:57:02
【问题描述】:
我很难理解 Tween 类的 begin 参数、AnimationController 类的 lowerBound 参数和 forward() 的 from 参数之间到底有什么区别在代码 sn-p 中的 animationController 对象上调用的函数。
哪个参数控制动画的哪些方面?提前致谢。
Animation animation;
AnimationController animationController;
HomeScreenState();
@override
void initState() {
super.initState();
animationController = AnimationController(vsync: this,duration: Duration(seconds: 1),/*lowerBound,upperBound*/);
animationController.addListener((){
if(animationController.isCompleted){
animationController.reverse();
} else if(animationController.isDismissed){
animationController.forward();
}
setState(() {
});
});
animationController.forward(/*from:*/);
}
@override
Widget build(BuildContext context) {
animation = CurvedAnimation(parent: animationController, curve: Curves.easeInOut);
animation = Tween(begin: -0.5,end: 0.5).animate(animation);
//other code
【问题讨论】: