clearRect method

void clearRect(
  1. num x,
  2. num y,
  3. num w,
  4. num h,
)

The CanvasRenderingContext2D.clearRect() method of the Canvas 2D API erases the pixels in a rectangular area by setting them to transparent black.

Note: Be aware that clearRect() may cause unintended side effects if you're not using paths properly. Make sure to call CanvasRenderingContext2D.beginPath before starting to draw new items after calling clearRect().

Implementation

external void clearRect(
  num x,
  num y,
  num w,
  num h,
);