animateToColor method

void animateToColor(
  1. Color color, {
  2. Duration duration = const Duration(milliseconds: 500),
  3. Curve curve = Curves.decelerate,
})
override

Implementation

void animateToColor(
  Color color, {
  Duration duration = const Duration(milliseconds: 500),
  Curve curve = Curves.decelerate,
}) {
  _tween = ColorTween(begin: this.color ?? Color(0x00000000), end: color);

  gameRef.getValueGenerator(
    duration,
    onChange: (value) {
      this.color = _tween?.transform(value);
    },
    onFinish: () {
      this.color = color;
    },
    curve: curve,
  ).start();
}