drawParticle method

  1. @override
void drawParticle(
  1. Canvas canvas,
  2. Size size,
  3. RainbowParticle particle
)
override

During

Implementation

@override
void drawParticle(Canvas canvas, Size size, RainbowParticle particle) {
  final offset = Offset(screenX, screenY);
  final offset2 = Offset(lastScreenX, lastScreenY);
  // Filter out the big jumps
  if ((offset - offset2).distance > 50) return;

  canvas.drawLine(
      offset,
      offset2,
      Paint()
        ..color = particle.c.withOpacity(1 - particle.t / 0.5)
        ..strokeWidth = 10.0 * 1 / (1 + particle.t * 5));
}