Static p5_sys::global::square[][src]

pub static square: SquareInternalType
Expand description

Draws a square to the screen. A square is a four-sided shape with every angle at ninety degrees, and equal side size. This function is a special case of the rect() function, where the width and height are the same, and the parameter is called "s" for side size. By default, the first two parameters set the location of the upper-left corner, the third sets the side size of the square. The way these parameters are interpreted, may be changed with the rectMode() function.

The fourth, fifth, sixth and seventh 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 square at location (30, 20) with a side size of 55.
square(30, 20, 55);
// Draw a square with rounded corners, each having a radius of 20.
square(30, 20, 55, 20);
// Draw a square with rounded corners having the following radii:
// top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.
square(30, 20, 55, 20, 15, 10, 5);

Parameters

x x-coordinate of the square.

y y-coordinate of the square.

s side size of the square.

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.