Skip to content

Instantly share code, notes, and snippets.

@antiboredom
Created September 8, 2013 22:38
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 antiboredom/6489144 to your computer and use it in GitHub Desktop.
Save antiboredom/6489144 to your computer and use it in GitHub Desktop.
Sun sketch for ICM week 1
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