【问题标题】:Flutter delayed animation shows no animation curveFlutter 延迟动画显示没有动画曲线
【发布时间】: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();
    }

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    Profile 或 Release 版本中的动画是否也很突然?

    我注意到我的动画在调试模式下也非常不一致和断断续续。 但是在 Profile 构建中,一切都很好。

    【讨论】:

    • 我修好了。间隔值大 1.0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-22
    • 1970-01-01
    • 2017-05-03
    • 2012-05-10
    • 1970-01-01
    相关资源
    最近更新 更多