Skip to content

Instantly share code, notes, and snippets.

@takawo
Last active October 23, 2015 00:11
Show Gist options
  • Save takawo/977c39159c4a6ca996d7 to your computer and use it in GitHub Desktop.
Save takawo/977c39159c4a6ca996d7 to your computer and use it in GitHub Desktop.
float x, y;
float r = 150;
float d = 0;
int n = 3;
void setup() {
size(500, 500);
rectMode(CENTER);
colorMode(HSB, 360, 100, 100);
frameRate(60);
}
void draw() {
background(0,0,0);
translate(width/2, height/2);
beginShape();
for ( int i = 0; i < n; i++) {
x = cos(radians(i*360/n + frameCount)) * r;
y = sin(radians(i*360/n + frameCount)) * r;
vertex(x, y);
}
noFill();
stroke(0, 0, 100);
strokeWeight(15-n);
endShape(CLOSE);
for ( int i = 0; i < n; i++) {
x = cos(radians(i*360/n + frameCount)) * r;
y = sin(radians(i*360/n + frameCount)) * r;
pushMatrix();
translate(x, y);
rotate(i*360/n);
fill(i*240/n, 80, 100);
noStroke();
beginShape();
for(int j =0; j < n; j++){
float x2 = cos(radians(j * 360/n ))*25;
float y2 = sin(radians(j * 360/n ))*25;
vertex(x2,y2);
}
endShape(CLOSE);
//rect(0, 0, 50, 50);
popMatrix();
}
if(frameCount%45 ==0){
n++;
if(n > 10){
n = 3;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment