Skip to content

Instantly share code, notes, and snippets.

@tai2
Last active December 17, 2015 08:59
Show Gist options
  • Select an option

  • Save tai2/5583759 to your computer and use it in GitHub Desktop.

Select an option

Save tai2/5583759 to your computer and use it in GitHub Desktop.
nothing to say
int quad_width = 25;
int rd = 10;
int[] colors = new int[180 / rd];
int color_idx = 0;
void setup() {
size(300, 300);
frameRate(24);
stroke(0, 100);
colorMode(HSB);
for (int i = 0; i < colors.length; i++) {
colors[i] = random_color();
}
}
color random_color() {
return color(random(255), 200, 255, 150);
}
void draw() {
background(255);
int centerx = width / 2;
int centery = height / 2;
float r = 0;
for (int i = 0; i < colors.length; i++) {
r += rd;
fill(colors[i]);
pushMatrix();
translate(centerx, centery);
rotate(radians(r));
quad(
-quad_width / 2, -height / 2,
quad_width / 2, -height / 2,
quad_width / 2, height / 2,
-quad_width / 2, height / 2);
popMatrix();
}
colors[color_idx % colors.length] = random_color();
color_idx++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment