xxxxxxxxxx
//spirograph
//5/25/15
//draws with three circles and not just two
float R = 275;// radius of big circle
float r = 203;//radius of circle 2
float r3 = 151;//radius of circle 3
float theta = 0;
float p = .8;//proportion of little circle
void setup(){
size(600,600);
background(0);
}
void draw(){
//background(0);
fill(255,0);//transparent
translate(width/2,height/2); //to center of big circle
stroke(255,0);
ellipse(0,0,2*R,2*R); //draw big circle
rotate(theta); //rotate to angle of circle2
translate(R - r,0); //go to center of circle2
ellipse(0,0,2*r,2*r); //draw little circle
float phi = -R/r*theta;//angle of rotation of circle 2
rotate(phi); //rotate phi
fill(255,0);
translate(r - r3,0); //go to center of circle 3
float angle3 = -r/r3*phi;//angle of rotation of circle 3
rotate(angle3);
line(0,0,p*r3,0);//draw using just this! cool.
translate(p*r3,0);
fill(255,0,0);
ellipse(0,0,2,2);//or point(...
theta += 0.01;
}