Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Animation avec Flutter

Animation avec Flutter

Session organisée au sein de notre communauté locale Dart & Flutter

Agnaramon Boris-Carnot

August 23, 2020
Tweet

More Decks by Agnaramon Boris-Carnot

Other Decks in Programming

Transcript

  1. Implicit Animation : Built-In Animated(Foo) - duration: Durée de l’animation

    - curve (option): Taux de change de l’animation : accéléré, décéléré, etc.
  2. Implicit Animation : Built-In AnimatedContainer( width: isBigger ? 300 :

    100, height: isBigger ? 300 : 100, color: Colors.blue, duration: Duration(seconds: 1), ),
  3. Implicit Animation : Custom TweenAnimationBuilder - duration: Durée - tween:

    Intervalle de valeur - builder: Appelé à chaque mise à jour de l’animation - curve (option)
  4. Implicit Animation : Custom TweenAnimationBuilder( duration: Duration(seconds: 1), tween: Tween<double>(begin:

    0.0, end: 2 * math.pi), builder: (context, value, child) { return Transform.rotate( angle: value, child: FlutterLogo() ); }, )
  5. Explicit Animation : Built-In class _AnimationTestState extends State<AnimationTest> with SingleTickerProviderStateMixin

    { AnimationController _animationController; @override void initState() { super.initState(); _animationController = AnimationController(duration: Duration(seconds: 2), vsync: this) ..repeat(); } @override void dispose() { _animationController.dispose(); super.dispose(); } RotationTransition( child: FlutterLogo( size: 60, ), turns: _animationController )
  6. Explicit Animation : Built-In Column( children: [ RotationTransition( child: FlutterLogo(

    size: 60, ), turns: _animationController, ), MaterialButton( child: Text('Click'), onPressed: () { if (_animationController.isAnimating) { _animationController.stop(); } else { _animationController.repeat(); } }, ) ], )
  7. Explicit Animation : Custom AnimatedBuilder( animation: _animationController, builder: (context, child)

    { return Transform.rotate( angle: _animationController.value * 2 * math.pi, child: Container( alignment: Alignment.center, width: 200, height: 200, color: Colors.blue, child: Text( 'Spin !’, style: TextStyle(fontSize: 20), ), ), ); }, )
  8. En savoir plus Overview https://flutter.dev/docs/development/ui/animations Hero Animation https://flutter.dev/docs/development/ui/animations/hero-animations Staggered Animation

    https://flutter.dev/docs/development/ui/animations/staggered-animations Implementing Complex UI with Flutter - Marcin Szałek https://www.youtube.com/watch?v=FCyoHclCqc8 Flutter Animation Sample https://flutter.github.io/samples/animations.html