Created
September 8, 2013 22:38
-
-
Save antiboredom/6489144 to your computer and use it in GitHub Desktop.
Sun sketch for ICM week 1
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
int rays = 24; | |
void setup() { | |
size(640, 460); | |
colorMode(HSB, 100, 100, 100, 100); | |
noStroke(); | |
drawSun(); | |
} | |
void draw() {} | |
void drawSun() { | |
background(map(mouseY, 0, height, 40, 60), 10, 100); | |
pushMatrix(); | |
translate(width / 2, height / 2); | |
rays = (int) map(mouseX, 0, width, 6, 20) * 2; | |
for (int i = 0; i < rays; i++) { | |
fill(random(20), 100, 100, 90); | |
triangle(random(10, 30), random(20, 30), random(20, 30), random(5, 8), width / 2, height / 2); | |
rotate(TWO_PI/ rays); | |
} | |
popMatrix(); | |
fill(0, 0, 100); | |
ellipse(width / 2, height / 2, 120, 120); | |
} | |
void mouseReleased() { | |
drawSun(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment