drawRain method

void drawRain(
  1. Canvas canvas,
  2. Size size
)

Implementation

void drawRain(Canvas canvas, Size size) {
  if (_state._images.length > 1) {
    ui.Image image = _state._images[0];
    if (_state._rainSnows.isNotEmpty) {
      for (RainSnowParams element in _state._rainSnows) {
        move(element);
        ui.Offset offset = ui.Offset(element.x, element.y);
        canvas.save();
        canvas.scale(element.scale);
        var identity = ColorFilter.matrix(<double>[
          1,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          0,
          element.alpha,
          0,
        ]);
        _paint.colorFilter = identity;
        canvas.drawImage(image, offset, _paint);
        canvas.restore();
      }
    }
  }
}