【发布时间】:2019-10-20 21:13:11
【问题描述】:
我目前遇到动画延迟的问题。我使用 FadeTransition 小部件淡入页面内容并淡出一些文本,这些文本显示在开头。 它可以工作,但是动画非常突然。
编辑:没关系。区间值 > 1.0。下面的代码现在可以正常工作了。
class _SinglePhotoState extends State<SinglePhoto> with TickerProviderStateMixin{
AnimationController controller, controllerText;
Animation<double> delayedAnimation, delayedText;
@override
void initState() {
// TODO: implement initState
super.initState();
controller = AnimationController(duration: const Duration(seconds: 5), vsync: this);
controllerText = AnimationController(duration: const Duration(seconds: 3), vsync: this);
delayedText = Tween(begin: 1.0, end: 0.0).animate(
CurvedAnimation(
parent: controllerText,
curve: Interval(0.25, 0.5, curve: Curves.easeIn)
));
delayedAnimation = Tween(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: controller,
curve: Interval(0.5, 1.0, curve: Curves.easeIn)
));
controllerText.forward();
controller.forward();
}
【问题讨论】: