simple_animations 1.3.3
simple_animations: ^1.3.3 copied to clipboard

outdated

Create awesome animations. Simplified. Well documented. With many examples.

example/main.dart

// "This is just one possibility what
//     you can do with simple_animations!"
//
// Documentation:
//   https://github.com/felixblaschke/simple_animations/tree/master/documentation
//
// Example App:
//   https://github.com/felixblaschke/simple_animations_example_app
//

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:simple_animations/simple_animations.dart';

void main() => runApp(Example());

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(child: Center(child: buildAnimation())),
      ),
    );
  }

  final tween = MultiTrackTween([
    Track("size").add(Duration(seconds: 4), Tween(begin: 0.0, end: 150.0)),
    Track("color")
        .add(Duration(seconds: 2),
            ColorTween(begin: Colors.red, end: Colors.blue),
            curve: Curves.easeIn)
        .add(Duration(seconds: 2),
            ColorTween(begin: Colors.blue, end: Colors.green),
            curve: Curves.easeOut),
    Track("rotation").add(Duration(seconds: 1), ConstantTween(0.0)).add(
        Duration(seconds: 3), Tween(begin: 0.0, end: pi / 2),
        curve: Curves.easeOutSine)
  ]);

  Widget buildAnimation() {
    return ControlledAnimation(
      playback: Playback.MIRROR,
      duration: tween.duration,
      tween: tween,
      builder: (context, animation) {
        return Transform.rotate(
          angle: animation["rotation"],
          child: Container(
            width: animation["size"],
            height: animation["size"],
            color: animation["color"],
          ),
        );
      },
    );
  }
}
1160
likes
0
pub points
98%
popularity

Publisher

felix-blaschke.de

Create awesome animations. Simplified. Well documented. With many examples.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on simple_animations