phaseAnimation<P> method

T phaseAnimation<P>({
  1. Listenable? trigger,
  2. required List<P> phases,
  3. required T styleBuilder(
    1. P phase,
    2. T style
    ),
  4. required CurveAnimationConfig configBuilder(
    1. P phase
    ),
})

Creates a phase animation. It will animate through the given phases.

Implementation

T phaseAnimation<P>({
  Listenable? trigger,
  required List<P> phases,
  required T Function(P phase, T style) styleBuilder,
  required CurveAnimationConfig Function(P phase) configBuilder,
}) {
  final styles = <T>[];
  final configs = <CurveAnimationConfig>[];

  for (final phase in phases) {
    styles.add(styleBuilder(phase, this as T));
    configs.add(configBuilder(phase));
  }

  return animate(
    PhaseAnimationConfig<S, T>(
      styles: styles,
      curveConfigs: configs,
      trigger: trigger,
    ),
  );
}