Created
August 30, 2017 02:00
-
-
Save anonymous/8c7c9211e4016636c3a8fe513d9571ae to your computer and use it in GitHub Desktop.
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 randomised set of squares inside each other | |
* They are of different shapes, colours and strokeweight | |
* it works with 2 parameters (x and y) | |
* x: the starting postion of pixels from top left | |
* y: the starting postion of pixels from top right | |
* playing with integer size will change position of sqaure | |
**/ | |
void drawConcentricSquares(float x, float y) { | |
rectMode(CENTER); | |
for (int i = 0; i < 100; i = i + 11) { | |
rect(random(10) + x, random(10) + y, i, i); | |
if (i%2 == 0) { // if i is even then.. | |
strokeWeight(0.5); | |
stroke(0); // strokeweight 0.5 in black | |
} else { // otherwise | |
strokeWeight(1.3); | |
stroke((0),random(255),random(255)); // strokeweight 1.3, in random blue or green | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment