Flutter 如何在初始介绍颤振后循环动画

Flutter 如何在初始介绍颤振后循环动画,flutter,loops,dart,animation,repeat,Flutter,Loops,Dart,Animation,Repeat,我尝试通过两个步骤在按钮小部件上循环动画: 1首次试飞(一次大规模试飞) 2小的重复弹跳(放大和缩小) 我似乎找不到更好的方法来做这件事。我已经玩了一段时间,得到了这个骇客解决方案,但它令人难以置信的僵硬和缓慢-所以肯定有一个更高性能的方法..这是动画代码的主要部分..谢谢 @override void initState() { _animController = AnimationController(duration: Duration(seconds: 3

我尝试通过两个步骤在按钮小部件上循环动画: 1首次试飞(一次大规模试飞) 2小的重复弹跳(放大和缩小)

我似乎找不到更好的方法来做这件事。我已经玩了一段时间,得到了这个骇客解决方案,但它令人难以置信的僵硬和缓慢-所以肯定有一个更高性能的方法..这是动画代码的主要部分..谢谢

  @override
  void initState() {
    _animController =
        AnimationController(duration: Duration(seconds: 30), vsync: this);

    _animController.repeat();

    _animController2 = AnimationController(
        duration: Duration(milliseconds: 2000), vsync: this);
    _animBounce = TweenSequence([
      TweenSequenceItem(tween: Tween<double>(begin: 0.0, end: 0.90), weight: 1),
      TweenSequenceItem(tween: Tween<double>(begin: 0.90, end: 1.0), weight: 1),
    ]).animate(_animController2);

    _animController2.forward();

    _animController2.addStatusListener((status) {
      if (_animController2.isCompleted) {
        _animController2.repeat(min: 0.5, max: 1.0, reverse: true);
      }
    });
@覆盖
void initState(){
_动物控制器=
AnimationController(持续时间:持续时间(秒数:30),vsync:this);
_animController.repeat();
_animController2=动画控制器(
持续时间:持续时间(毫秒:2000),vsync:this;
_animBounce=两个序列([
TweenSequenceItem(tween:tween(开始:0.0,结束:0.90),重量:1),
TweenSequenceItem(tween:tween(开始:0.90,结束:1.0),重量:1),
]).制作动画(_animController2);
_animController2.forward();
_animController2.addStatusListener((状态){
如果(_animController2.isCompleted){
_animController2.重复(最小值:0.5,最大值:1.0,反向:真);
}
});