draw method

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

Implementation

void draw(Canvas canvas, Size size) {
  canvas.save();
  if(_state._state == RenderState.drawing){
    for (var element in _state._particles) {
      element.advance(_state._controller!.value, _state.V, _state.END_VALUE);
      if(element.alpha > 0){
        canvas.drawImageRect(element.image,
            Rect.fromLTWH(0, 0, element.image.width.toDouble(), element.image.height.toDouble()),
            Rect.fromLTWH(element.cx - element.image.width / 4, element.cy - element.image.height / 4, element.image.width.toDouble()/2, element.image.height.toDouble()/2),
            _paint);
      }
    }
  }
  if(_state._state1 == RenderState.drawing){
    for (var element in _state._particles1) {
      element.advance(_state._controller1!.value, _state.V, _state.END_VALUE);
      if(element.alpha > 0){
        canvas.drawImageRect(element.image,
            Rect.fromLTWH(0, 0, element.image.width.toDouble(), element.image.height.toDouble()),
            Rect.fromLTWH(element.cx - element.image.width / 4, element.cy - element.image.height / 4, element.image.width.toDouble()/2, element.image.height.toDouble()/2),
            _paint);
      }
    }
  }

  if(_state._state2 == RenderState.drawing){
    for (var element in _state._particles2) {
      element.advance(_state._controller2!.value, _state.V, _state.END_VALUE);
      if(element.alpha > 0){
        canvas.drawImageRect(element.image,
            Rect.fromLTWH(0, 0, element.image.width.toDouble(), element.image.height.toDouble()),
            Rect.fromLTWH(element.cx - element.image.width / 4, element.cy - element.image.height / 4, element.image.width.toDouble()/2, element.image.height.toDouble()/2),
            _paint);
      }
    }
  }
  canvas.restore();

}