xxxxxxxxxx
size (225, 300);
//---------- CORNER(S) ORIENTATION, Draws stuff from the corner
/* *DEFAULT*
The default mode is rectMode(CORNER), which interprets the first two
parameters of rect() as the upper-left corner of the shape, while the
third and fourth parameters are its width and height.
*/
rectMode(CORNER); // Set rectMode is CORNER
fill (102, 66, 124); // Set fill to purple
rect(25, 25, 50, 50); // Draw rectangle using CORNER mode
/*
rectMode(CORNERS) interprets the first two parameters of rect() as the
location of one corner, and the third and fourth parameters as the
location of the opposite corner.
*/
rectMode(CORNERS); // Set rectMode to CORNERS
fill(184, 255, 7); // Set fill to green
rect(25, 25, 50, 50); // Draw rectangle using CORNERS mode
//--------- CENTER ORIENTATION : Draws stuff using the rectangle's center
/*
rectMode(RADIUS) also uses the first two parameters of rect() as the
shape's center point, but uses the third and fourth parameters to specify
half of the shapes's width and height.
rect(x, y, totalWidth, totalHeight); // x, y from center
*/
rectMode(RADIUS); // Set rectMode to RADIUS
fill(255, 7, 114); // Set fill to pink
rect(50, 150, 30, 30); // Draw rectangle using RADIUS mode
/*
rectMode(CENTER) interprets the first two parameters of rect() as the
shape's center point, while the third and fourth parameters are its width
and height.
rect(x, y, totalWidth, totalHeight); // x, y from center
*/
rectMode(CENTER); // Set rectMode to CENTER
fill(255, 209, 7); // Set fill to yellow
rect(50, 150, 30, 30); // Draw rectangle using CENTER mode