getAnimations method

  1. @override
List<CharacterAnimation> getAnimations(
  1. double progress,
  2. int charCount
)
override

Generates per-character animations by shifting the gradient position based on progress so the color band sweeps across the text.

Implementation

@override
List<CharacterAnimation> getAnimations(double progress, int charCount) {
  if (charCount == 0 || colors.isEmpty) return [];

  return List.generate(charCount, (index) {
    // Compute each character's normalized position + progress shift.
    final t = index / (charCount - 1).clamp(1, charCount);
    final shifted = (t + progress) % 1.0;
    final color = _lerpColors(shifted);
    return CharacterAnimation(color: color);
  });
}