Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2017 11:56
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/88d3636e844ebc9dcd7c2fc84a123dd2 to your computer and use it in GitHub Desktop.
Save anonymous/88d3636e844ebc9dcd7c2fc84a123dd2 to your computer and use it in GitHub Desktop.
70s kitchen tile pattern
// weight of line around shape, rotation of shape and number of iterations for loop
void kitchenTile(int aWeight, int aDegreesRotate, int numIterations) {
int distAdded = 0; // how far to set shapes part
translate(width/2, height/2); // changes the location of 0,0, or origin
for (int x = 1; x<numIterations; x++) { // number of time to run this loop. Recommend at least 50
int y = 0;
strokeWeight(aWeight);
fill(random(255), random(200-230), random(200-240), random(40, 100)); // reduced colour pallette
rotate(radians(aDegreesRotate)); // rotates the canvas by n degrees and converts to radians
rect(0+distAdded, 0-distAdded, sizeX+distAdded, sizeY-distAdded);
if (x%(360/degreesRotate)==0) { // when modulo x results in remainer of 0 it adds to the shapes x/y position
distAdded=distAdded+45;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment