Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 01:17
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/9d07ab2c11ac55e4bc36c5abc2e6f490 to your computer and use it in GitHub Desktop.
Save anonymous/9d07ab2c11ac55e4bc36c5abc2e6f490 to your computer and use it in GitHub Desktop.
colourRect.java meda102
/**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(int x, int y,float rotationInDegrees) {
pushMatrix();
translate(400,300);
rotate(radians(rotationInDegrees)+45);
noStroke();
fill(random(255),random(255),random(255),150);
rect(x,y,50,50);
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment