Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e2e106daac89ce66fe876f944b1790f3 to your computer and use it in GitHub Desktop.
Save anonymous/e2e106daac89ce66fe876f944b1790f3 to your computer and use it in GitHub Desktop.
colourRect.java REVISED
/**Creates a randomly sized rectangle, with a random opaque colour,
*that is placed at a random point around a shifted centre point,
*each with at least a 45 degree rotation.
*Best animated in a loop with a framerate of 50.
*/
void colourRect() {
background(0);
for (int i = 0; i < 800; i = i + 5) {
for (int f = 0; f < 800; f = f + 5) {
pushMatrix();
translate(400,300);
rotate(radians(random(360)));
noStroke();
fill(random(255),random(255),random(255),150);
rect(i,f,50,50);
popMatrix();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment