Help us understand the problem. What is going on with this article?

[Flutter] animationを使って試してみた。その2

More than 1 year has passed since last update.

おはようございます
どんどん寒くなり、今年もまもなく終わりになります。
頑張りましょう。

以前の投稿(連関)

  1. [Flutter] animationを使って試してみた。

Stateful

Stateful でつかいます。

Curved Animation

  1. [Flutter] アニメーションのCurves
  2. https://docs.flutter.io/flutter/animation/Curves-class.html
 animation = CurvedAnimation(parent: animationController, curve: Curves.bounceOut);
   animation.addStatusListener((status) {
      if (status == AnimationStatus.completed) {
        animationController.reverse();
      } else if (status == AnimationStatus.dismissed) {
        animationController.forward();
      }
    });

class AnimatedLogo extends AnimatedWidget {
  final Tween<double> _sizeAnim = Tween<double>(begin: 0.0, end: 500.0);

//  final CurvedAnimation _sizeAnim = CurvedAnimation(begin: 0.0, end: 500.0);

  AnimatedLogo({Key key, Animation animation})
      : super(key: key, listenable: animation);

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    final Animation<double> animation = listenable;
    return Transform.scale(
      scale: animation.value * 50,
      child: FlutterLogo(),
    );
  }
}

ここ注目ポイント。

  return Transform.scale(
      scale: animation.value * 50,
      child: FlutterLogo(),
    );

最後に是非忘れないで~

@override
  void dispose() {
    // TODO: implement dispose
    animationController.dispose();
    super.dispose();
  }

これなら。

  1. 心臓が動いているアニメーションができる。

녹화_2018_11_30_07_32_49_871.gif

参考

  1. https://flutter.io/docs/development/ui/animations/tutorial
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away