Canvas

Canvas Tutorials

Canvas Methods and Properties

HTML canvas clearRect() Method

HTML canvas clearRect() Method

 

 

The clearRect() method is used to clear the specified pixels within a given rectangle.

 

Syntax:-

 

Its syntax is:- context.clearRect(x, y, width, height);

 

Further Explanation:-

 

Parameter Description
x The x-coordinate of the upper-left corner of the rectangle to clear
y The y-coordinate of the upper-left corner of the rectangle to clear
width The width of the rectangle to clear, in pixels
height The height of the rectangle to clear, in pixels

Code Explanation

All Tutorials related to Canvas Methods and Properties

All Sections related to Canvas