如何在Flutter中跳过NimaActor动画的第一个15毫秒

时间:2018-11-16 09:13:37

标签: animation dart flutter

我一直在尝试将NimaAnimation添加到我的项目中,但不幸的是,我的Animation是如此,它从屏幕外部到屏幕中心。对于Nima Animation,它首先渲染图像,然后开始动画。有没有一种方法可以跳过动画的第一个15毫秒。

我为此编写的代码是:

class WelcomeScreenState extends State<WelcomeScreen> {

      bool delayed;

  void initState() {
    super.initState();
    new Future.delayed(const Duration(milliseconds: 6200), (){
        Navigator.of(context).pushReplacementNamed('/tab');
        setState(() {
                  delayed = true;
                });
      });  
  }

  @override
  Widget build(BuildContext context) {
    MediaQueryData media = MediaQuery.of(context);

    var size = media.size;

    // TODO: implement build
    return (delayed == true ) ? new TabHome() : new Scaffold(
        body: new Container(
          height: size.height,
          width: size.width,
            decoration: new BoxDecoration(
              color: Colors.purple,
            ),
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                new Container(
                    height: size.height * 0.5,
                    width: size.width,
                    child: new NimaActor(
                        "assets/quack",
                        alignment: Alignment.center,
                        fit: BoxFit.scaleDown,
                        animation: 'welcome with hello',
                        mixSeconds: 0.1,
                      ),),
                ])));
  }
}

0 个答案:

没有答案