sa_multi_tween 0.0.3  sa_multi_tween: ^0.0.3 copied to clipboard
sa_multi_tween: ^0.0.3 copied to clipboard
MultiTween (part of Simple Animations Framework) can animate multiple properties at once.
example/example.md
Note: This example uses supercharged package for syntactic sugar and simple_animations for using
ControlledAnimationwidget.
// Define properties as enum
enum AniProps { width, height }
// Specify MultiTween
final _tween = MultiTween<AniProps>()
  ..add(AniProps.width, Tween(begin: 0.0, end: 100.0), 1000.milliseconds)
  ..add(AniProps.width, Tween(begin: 100.0, end: 200.0), 500.milliseconds)
  ..add(AniProps.height, Tween(begin: 0.0, end: 200.0), 2500.milliseconds);
Use the created _tween in your builder() function:
ControlledAnimation<MultiTweenAnimatable<AniProps>>(
  tween: _tween,
  // Obtain total duration from MultiTween
  duration: _tween.duration,
  builder: (context, animation) {
    return Container(
      // Get animated width as double value
      width: animation.get<double>(AniProps.width),
      // Get animated height as double value
      height: animation.get<double>(AniProps.height),
      color: Colors.yellow,
    );
  },
),