[][src]Static p5_sys::global::rect

pub static rect: RectInternalType

Draws a rectangle on the canvas. A rectangle is a four-sided closed shape with every angle at ninety degrees. 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, may be changed with the rectMode() function.

The fifth, sixth, seventh and eighth parameters, if specified, determine corner radius for the top-left, top-right, lower-right and lower-left corners, respectively. An omitted corner radius parameter is set to the value of the previously specified radius value in the parameter list.

Examples

// Draw a rectangle at location (30, 20) with a width and height of 55.
rect(30, 20, 55, 55);
// Draw a rectangle with rounded corners, each having a radius of 20.
rect(30, 20, 55, 55, 20);
// Draw a rectangle with rounded corners having the following radii:
// top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.
rect(30, 20, 55, 55, 20, 15, 10, 5);

Overloads

x x-coordinate of the rectangle.

y y-coordinate of the rectangle.

w width of the rectangle.

h? height of the rectangle.

tl? optional radius of top-left corner.

tr? optional radius of top-right corner.

br? optional radius of bottom-right corner.

bl? optional radius of bottom-left corner.


x x-coordinate of the rectangle.

y y-coordinate of the rectangle.

w width of the rectangle.

h height of the rectangle.

detailX? number of segments in the x-direction (for WebGL mode)

detailY? number of segments in the y-direction (for WebGL mode)