Skip to content

Instantly share code, notes, and snippets.

@triss
Last active August 29, 2015 13:56
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 triss/8883949 to your computer and use it in GitHub Desktop.
Save triss/8883949 to your computer and use it in GitHub Desktop.
fractal 0.1
// https://github.com/triss/colourlovers
import triss.colourlovers.*;
color[] colours;
int c;
void setup() {
size(1000, 1000);
noLoop();
c = 0;
ColourLovers cl = new ColourLovers(this);
ColourLoversPalette pal = cl.getRandomPalette();
println(pal.getId());
colours = pal.getColours();
}
void draw() {
background(255);
noStroke();
translate(width / 2, height / 2);
rotate(radians(180));
circs(7, height * 0.36, 3);
}
void circs(float rotations, float size, int depth) {
if(depth > 0) {
for(int r = 0; r < 360; r+= 360 / rotations) {
pushMatrix();
rotate(radians(r));
noStroke();
translate(0, size / 2);
fill(colours[c++ % colours.length], 200);
ellipse(0, 0, size / 10, size / 2);
circs(rotations, size * 0.66, depth - 1);
popMatrix();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment