Last active
December 17, 2015 08:59
-
-
Save tai2/5583759 to your computer and use it in GitHub Desktop.
nothing to say
This file contains hidden or 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 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