Created
August 30, 2017 01:57
-
-
Save anonymous/2a0846d2262d80aa5cf2d71504e8f6c9 to your computer and use it in GitHub Desktop.
Squares/Jake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function draws a series of different squares. | |
* It takes 2 parameters (x and y) which define | |
* the position of the square that is drawn. | |
* x: the distance in pixels from the top left | |
* y: the distance in pixels from the top right | |
**/ | |
void DrawSquares(float x, float y) { | |
noStroke(); | |
for (int i = 0; i < 60; i = i + 5) { | |
if (i%3 == 0) { // this line says "if i is an odd then..." | |
fill(0); //fill white | |
} | |
else { // otherwise | |
fill(random (255), random (255), random (255)); //fill in random colour | |
} | |
rect(x, y, 60 - i, 60 - i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment