drawEffect method

void drawEffect(
  1. Canvas canvas,
  2. Size size
)
override

Implementation

void drawEffect(Canvas canvas, Size size) {
  Color currentColor = color.getCurrentColor();

  Path path = Path();
  //move path to position
  path.moveTo(
      position.getAbsolutePair(size).x, position.getAbsolutePair(size).y);

  for (EVector2D pathPoint in _pathPoint) {
    path.lineTo(pathPoint.x, pathPoint.y);
  }

  path.close();
  Paint pathPaint = Paint()..color = currentColor;
  if (lightningBlur > 0) {
    pathPaint.maskFilter = MaskFilter.blur(BlurStyle.normal, lightningBlur);
  }
  pathPaint.blendMode = BlendMode.lighten;

  for (int i = 0; i < repainter; i++) {
    canvas.drawPath(path, pathPaint);
  }

  for (ELightning eLightning in _sideLightning) {
    eLightning.draw(canvas, size);
  }
}