Created
August 30, 2017 01:41
-
-
Save anonymous/240709c51d9f3bbc6d30134e5ed53706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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