Canvas

Canvas Tutorials

Canvas Methods and Properties

HTML canvas strokeRect() Method

HTML canvas strokeRect() Method

 

 

The strokeRect() method is used to draw a rectangle. We can change its color by strokeStyle() property.

 

Default Value:-

 

The default color is Black.

 

Syntax:-

 

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

 

Further Explanation:-

 

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

Code Explanation

All Tutorials related to Canvas Methods and Properties

All Sections related to Canvas