getAnimations method

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

Generates per-character noise-based jitter with rotation.

Implementation

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

  final curved = applyCurve(progress);

  return List.generate(charCount, (index) {
    final phase = noise(index) * 2 * pi;
    final returnT = curved * (1.0 - curved) * 4;
    final angle = curved * 2 * pi * frequency + phase;
    final dx = sin(angle) * amplitude * returnT;
    final dy = cos(angle * 0.7) * amplitude * returnT;
    final rot = sin(angle * 0.5) * rotationAmplitude * returnT;

    return CharacterAnimation(
      translation: Offset(dx, dy),
      rotation: rot,
    );
  });
}