JavaScript canvas2d object method: clearRect()
[this page | pdf | back links]
The clearRect() method of the JavaScript
DOM object returned
by the getContext("2d")
method applied to the HTML <canvas>
element clears specified pixels within a rectangle.
It has the following
syntax with the following parameters.
context.clearRect(x, y, width, height)
|
Parameter
|
Required / Optional
|
Description
|
|
x
|
Required
|
x-coordinate of
upper-left corner
|
|
y
|
Required
|
y-coordinate of
upper-left corner
|
|
width
|
Required
|
Width of rectangle, in
pixels
|
|
height
|
Required
|
Height of rectangle, in
pixels
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)