getAnimations method

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

Generates per-character rotationY following a traveling sine wave.

Implementation

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

  final curved = applyCurve(progress);

  return List.generate(charCount, (index) {
    final phase = 2 * pi * waveCount * (index / max(charCount - 1, 1));
    final wave = sin(curved * 2 * pi - phase);
    final returnT = sin(curved * pi);
    final rotationY = wave * amplitude * returnT;

    return CharacterAnimation(rotationY: rotationY);
  });
}