rect(x, y, w, h, [tl], [tr], [br], [bl])
Draws a rectangle on the page.
By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. The way these parameters are interpreted, however, may be changed with the rectMode()
function.
The fifth, sixth, seventh and eighth parameters, if specified, determine corner radius for the top-right, top-left, lower-right and lower-left corners, respectively. If only a fifth parameter is provided, all corners will be set to this radius.
Type: function
Parameter(s):
- x {Number}:
X-coordinate of the rectangle.
- y {Number}:
Y-coordinate of the rectangle.
- w {Number}:
Width of the rectangle.
- h {Number}:
Height of the rectangle.
- tl {Number} Optional:
Radius of top left corner or radius of all 4 corners (optional).
- tr {Number} Optional:
Radius of top right corner (optional).
- br {Number} Optional:
Radius of bottom right corner (optional).
- bl {Number} Optional:
Radius of bottom left corner (optional).
Returns:
-
{Rectangle}:
The rectangle that was created.