Description
Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. The first two parameters set the location, the third sets the width, and the fourth sets the height.
Syntax
|
rect(x, y, width, height) |
Parameters
x – x-coordinate of the rectangle
y – y-coordinate of the rectangle
width – width of the rectangle
height – height of the rectangle
Returns
none
Example
// Fill screen with random colored, random sized recs
void setup()
void loop()
{
stroke(random(255),random(255),random(255));
fill(random(255),random(255),random(255));
rect(random(320),random(240),random(320),random(240));
}
Related
none
Bugs
By: Mike Gionfriddo on 12/23/2008
1) When I make a small square, it doesn’t draw it properly
2) When I draw a rectangle that goes off the screen it doesn’t execute the color fill function.
January 26, 2009
These bugs are fixed in version 1.1.0 of the SubPGraphics library which is used for both the Shield and the Slide
Mark Sproul