getAnimations method

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

Generates per-character fly-in from noise-based random directions.

Implementation

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

  return List.generate(charCount, (index) {
    final staggered = staggeredProgress(progress, index, charCount);
    final curved = applyCurve(staggered);
    final remaining = 1.0 - curved;

    final angle = noise(index) * 2 * pi;
    final dist = distance * (0.5 + noise(index, 1) * 0.5);
    final dx = cos(angle) * dist * remaining;
    final dy = sin(angle) * dist * remaining;

    return CharacterAnimation(
      translation: Offset(dx, dy),
      opacity: curved.clamp(0.0, 1.0),
    );
  });
}