Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 23: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/a0757cb4e04756c2ccda3f5692970e71 to your computer and use it in GitHub Desktop.
Save anonymous/a0757cb4e04756c2ccda3f5692970e71 to your computer and use it in GitHub Desktop.
/**
* This function draws a fishscale type pattern.
* It takes 2 parameters (x and y) which define
* the position of the target that is drawn.
* x: the distance in pixels from the top left
* y: the distance in pixels from the top right
**/
void drawFishScales(float x, float y) {
noStroke();
for (int i = 0; i < 50; i = i + 5) {
if (i%2 == 0) { // this line says "if i is an even number then..."
fill(255); // fill in white
}
else { // otherwise
// fill(0); // fill in black
fill(random(255));
}
ellipse(x, y, 50 - i, 50 - i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment