xxxxxxxxxx
float r1;
float r2;
float r3;
float r4;
float r5;
float r6;
// Angle and angular velocity, accleration
float theta;
float theta_vel;
float theta_acc;
void setup() {
//fullScreen();
size(700,700);
// Initialize all values
r1=75;
r2=125;
r3=175;
r4=225;
r5=275;
r6=325;
theta = 0;
theta_vel = 0;
theta_acc = 0.000065;
}
void draw() {
background(0);
noCursor();
translate(width/2, height/2);
float x = r1 * cos(1.1*theta);
float y = r1 * sin(1.1*theta);
float x1 = r2 * cos(1.08*theta);
float y1 = r2 * sin(1.08*theta);
float x2 = r3 * cos(1.06*theta);
float y2 = r3 * sin(1.06*theta);
float x3 = r4 * cos(1.04*theta);
float y3 = r4 * sin(1.04*theta);
float x4 = r5 * cos(1.02*theta);
float y4 = r5 * sin(1.02*theta);
float x5 = r6 * cos(theta);
float y5 = r6 * sin(theta);
float a = r1 * cos(-1.1*theta);
float b = r1 * sin(-1.1*theta);
float a1 = r2 * cos(-1.08*theta);
float b1 = r2 * sin(-1.08*theta);
float a2 = r3 * cos(-1.06*theta);
float b2 = r3 * sin(-1.06*theta);
float a3 = r4 * cos(-1.04*theta);
float b3 = r4 * sin(-1.04*theta);
float a4 = r5 * cos(-1.02*theta);
float b4 = r5 * sin(-1.02*theta);
float a5 = r6 * cos(-theta);
float b5 = r6 * sin(-theta);
// Draw the ellipse at the cartesian coordinate
ellipseMode(CENTER);
strokeWeight(1.5);
fill(0);
stroke(random(450),random(450),random(450));
ellipse(0,0,677,677);
stroke(random(450),random(450),random(450));
ellipse(0,0,579,579);
stroke(random(450),random(450),random(450));
ellipse(0,0,481,481);
stroke(random(450),random(450),random(450));
ellipse(0,0,383,383);
stroke(random(450),random(450),random(450));
ellipse(0,0,286,286);
stroke(random(450),random(450),random(450));
ellipse(0,0,187,187);
stroke(random(450),random(450),random(450));
ellipse(0,0,115,115);
fill(random(450),random(450),random(450));
ellipse(x,y,35,35);
ellipse(-x,-y,35,35);
ellipse(x1,y1,33,33);
ellipse(-x1,-y1,33,33);
ellipse(x2,y2,31,31);
ellipse(-x2,-y2,31,31);
ellipse(x3,y3,29,29);
ellipse(-x3,-y3,29,29);
ellipse(x4,y4,27,27);
ellipse(-x4,-y4,27,27);
ellipse(x5,y5,25,25);
ellipse(-x5,-y5,25,25);
if (key == CODED) {
if(keyCode == DOWN){
ellipse(x,y,35,35);
ellipse(-x,-y,35,35);
ellipse(x1,y1,33,33);
ellipse(-x1,-y1,33,33);
ellipse(x2,y2,31,31);
ellipse(-x2,-y2,31,31);
ellipse(x3,y3,29,29);
ellipse(-x3,-y3,29,29);
ellipse(x4,y4,27,27);
ellipse(-x4,-y4,27,27);
ellipse(x5,y5,25,25);
ellipse(-x5,-y5,25,25);
}
if(keyCode == UP){
strokeWeight(3);
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(x, y);
curveVertex(x1, y1);
curveVertex(x2, y2);
curveVertex(x3, y3);
curveVertex(x4, y4);
curveVertex(x5, y5);
curveVertex(x5, y5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-x, -y);
curveVertex(-x1, -y1);
curveVertex(-x2, -y2);
curveVertex(-x3, -y3);
curveVertex(-x4, -y4);
curveVertex(-x5, -y5);
curveVertex(-x5, -y5);
endShape();
strokeWeight(1.5);
line(x1,y1,-x1,-y1);
line(x2,y2,-x2,-y2);
line(x3,y3,-x3,-y3);
line(x4,y4,-x4,-y4);
line(x5,y5,-x5,-y5);
}
if (keyCode == RIGHT) {
ellipse(b,a,35,35);
ellipse(-b,-a,35,35);
ellipse(b1,a1,33,33);
ellipse(-b1,-a1,33,33);
ellipse(b2,a2,31,31);
ellipse(-b2,-a2,31,31);
ellipse(b3,a3,29,29);
ellipse(-b3,-a3,29,29);
ellipse(b4,a4,27,27);
ellipse(-b4,-a4,27,27);
ellipse(b5,a5,25,25);
ellipse(-b5,-a5,25,25);
}
if (keyCode == LEFT) {
strokeWeight(3);
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(x, y);
curveVertex(x1, y1);
curveVertex(x2, y2);
curveVertex(x3, y3);
curveVertex(x4, y4);
curveVertex(x5, y5);
curveVertex(x5, y5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-x, -y);
curveVertex(-x1, -y1);
curveVertex(-x2, -y2);
curveVertex(-x3, -y3);
curveVertex(-x4, -y4);
curveVertex(-x5, -y5);
curveVertex(-x5, -y5);
endShape();
strokeWeight(1.5);
line(x,y,-x1,-y1);
line(x1,y1,-x2,-y2);
line(x2,y2,-x3,-y3);
line(x3,y3,-x4,-y4);
line(x4,y4,-x5,-y5);
line(-x,-y,x1,y1);
line(-x1,-y1,x2,y2);
line(-x2,-y2,x3,y3);
line(-x3,-y3,x4,y4);
line(-x4,-y4,x5,y5);
}
if(keyCode == CONTROL){
setup();
}
if(keyCode == SHIFT){
ellipse(b,a,35,35);
ellipse(-b,-a,35,35);
ellipse(b1,a1,33,33);
ellipse(-b1,-a1,33,33);
ellipse(b2,a2,31,31);
ellipse(-b2,-a2,31,31);
ellipse(b3,a3,29,29);
ellipse(-b3,-a3,29,29);
ellipse(b4,a4,27,27);
ellipse(-b4,-a4,27,27);
ellipse(b5,a5,25,25);
ellipse(-b5,-a5,25,25);
strokeWeight(3);
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(b, a);
curveVertex(b1, a1);
curveVertex(b2, a2);
curveVertex(b3, a3);
curveVertex(b4, a4);
curveVertex(b5, a5);
curveVertex(b5, a5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-b, -a);
curveVertex(-b1, -a1);
curveVertex(-b2, -a2);
curveVertex(-b3, -a3);
curveVertex(-b4, -a4);
curveVertex(-b5, -a5);
curveVertex(-b5, -a5);
endShape();
stroke(random(450),random(450),random(450));
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(x, y);
curveVertex(x1, y1);
curveVertex(x2, y2);
curveVertex(x3, y3);
curveVertex(x4, y4);
curveVertex(x5, y5);
curveVertex(x5, y5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-x, -y);
curveVertex(-x1, -y1);
curveVertex(-x2, -y2);
curveVertex(-x3, -y3);
curveVertex(-x4, -y4);
curveVertex(-x5, -y5);
curveVertex(-x5, -y5);
endShape();
}
if(keyCode == ALT){
ellipse(b,a,35,35);
ellipse(-b,-a,35,35);
ellipse(b1,a1,33,33);
ellipse(-b1,-a1,33,33);
ellipse(b2,a2,31,31);
ellipse(-b2,-a2,31,31);
ellipse(b3,a3,29,29);
ellipse(-b3,-a3,29,29);
ellipse(b4,a4,27,27);
ellipse(-b4,-a4,27,27);
ellipse(b5,a5,25,25);
ellipse(-b5,-a5,25,25);
strokeWeight(3);
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(b, a);
curveVertex(b1, a1);
curveVertex(b2, a2);
curveVertex(b3, a3);
curveVertex(b4, a4);
curveVertex(b5, a5);
curveVertex(b5, a5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-b, -a);
curveVertex(-b1, -a1);
curveVertex(-b2, -a2);
curveVertex(-b3, -a3);
curveVertex(-b4, -a4);
curveVertex(-b5, -a5);
curveVertex(-b5, -a5);
endShape();
stroke(random(450),random(450),random(450));
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(x, y);
curveVertex(x1, y1);
curveVertex(x2, y2);
curveVertex(x3, y3);
curveVertex(x4, y4);
curveVertex(x5, y5);
curveVertex(x5, y5);
endShape();
noFill();
beginShape();
curveVertex(0, 0);
curveVertex(0, 0);
curveVertex(-x, -y);
curveVertex(-x1, -y1);
curveVertex(-x2, -y2);
curveVertex(-x3, -y3);
curveVertex(-x4, -y4);
curveVertex(-x5, -y5);
curveVertex(-x5, -y5);
endShape();
strokeWeight(1);
line(x1,y1,-x1,-y1);
line(x2,y2,-x2,-y2);
line(x3,y3,-x3,-y3);
line(x4,y4,-x4,-y4);
line(x5,y5,-x5,-y5);
line(b1,a1,-b1,-a1);
line(b2,a2,-b2,-a2);
line(b3,a3,-b3,-a3);
line(b4,a4,-b4,-a4);
line(b5,a5,-b5,-a5);
}
}
fill(0);
stroke(random(450),random(450),random(450));
strokeWeight(2);
ellipse(0,0,15,15);
// Apply acceleration and velocity to angle (r remains static in this example)
theta_vel += theta_acc;
theta += theta_vel;
}