createPainter method

  1. @override
CustomPainter createPainter({
  1. required Color color,
  2. required double animationValue,
  3. required double strokeWidth,
})
override

Method to create custom painter

Implementation

@override
CustomPainter createPainter({
  required Color color,
  required double animationValue,
  required double strokeWidth,
}) {
  // Rocking: -angle -> +angle -> -angle
  // sin wave
  final angle =
      math.sin(animationValue * math.pi * 2) * 0.05; // Small rotation

  return BusFrontPainter(
    color: color,
    angle: angle,
    strokeWidth: strokeWidth,
  );
}