DotAnimationConfig.forIndex constructor

DotAnimationConfig.forIndex({
  1. required int index,
  2. required int dotCount,
  3. required double baseSize,
  4. required bool isEven,
})

Creates a config for a dot based on its index and total dot count.

Implementation

factory DotAnimationConfig.forIndex({
  required int index,
  required int dotCount,
  required double baseSize,
  required bool isEven,
}) {
  final step = 0.09; // Interval step for staggering animations
  final start = index * step;
  return DotAnimationConfig(
    heightInterval: Interval(start, start + step),
    offsetInterval: Interval(start + step, start + 2 * step),
    reverseHeightInterval: Interval(start + 2 * step, start + 3 * step),
    reverseOffsetInterval: Interval(start + 3 * step, start + 4 * step),
    maxHeight: isEven ? baseSize * 0.7 : baseSize * 0.4,
    maxOffset: -(baseSize * 0.20),
  );
}