Skip to content

Instantly share code, notes, and snippets.

Created August 30, 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/240709c51d9f3bbc6d30134e5ed53706 to your computer and use it in GitHub Desktop.
Save anonymous/240709c51d9f3bbc6d30134e5ed53706 to your computer and use it in GitHub Desktop.
/**
* This function draws a target.
* 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 drawRay(float y, float x) {
noStroke();
for (int i = 0; i <= 99; i = i + 9) {
if (i%2 == 0) { // this line says "if i is an even number then..."
stroke(0,50);
fill(0,150);
} else { // otherwise
float r = random(255);
float g = random(255);
float b = random(255);
strokeWeight(1.5);
noStroke();
fill(random(255),g,b,r);
}
ellipse(random(100) +x ,random(100) +y, i, i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment