animateTo method

void animateTo(
  1. LightingConfig config, {
  2. Duration duration = const Duration(milliseconds: 500),
  3. Curve curve = Curves.decelerate,
})

Animates the current configuration to config.

The radius, color, blur and alignment are interpolated. Discrete fields (type, mode, pulses) switch when the animation crosses its middle point. When there is no current configuration, or duration is zero, the configuration is applied immediately.

Implementation

void animateTo(
  LightingConfig config, {
  Duration duration = const Duration(milliseconds: 500),
  Curve curve = Curves.decelerate,
}) {
  final current = _config;
  if (current == null || duration <= Duration.zero) {
    setup(config);
    return;
  }

  _animationStart = current;
  _animationTarget = config;
  _animationDuration = duration;
  _animationCurve = curve;
  _animationElapsed = 0;
}