Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(400,400);
- background(0);
- noLoop();
- }
- //radii of the circles
- float r1=200;
- float r2=r1*3/8;
- float r3=r2*3/8;
- float r4=r3*3/8;
- float r5=r4*3/8;
- int i=0;
- //rotations of the circles
- float rot1;
- float rot2;
- float rot3;
- float rot4;
- void draw() {
- //background(255,0,0);
- noStroke();
- //stroke(0);
- noFill();
- translate(200,200);
- rot1=i--*PI/300;
- rotate(rot1);
- ellipse(0,0,2*r1,2*r1);
- //circle
- pushMatrix();
- translate(0,-r1+r2);
- noStroke();
- //stroke(0);
- ellipse(0,0,2*r2,2*r2);
- stroke(255,0,0);
- point(0,0);
- rotate(-rot1);
- rot2=rot1*3;
- rotate(-rot2);
- //circle
- pushMatrix();
- translate(0,-r2+r3);
- noStroke();
- //stroke(0);
- ellipse(0,0,2*r3,2*r3);
- stroke(0,255,0);
- point(0,0);
- rotate(rot2);
- rot3=rot2*3;
- rotate(rot3);
- //circle
- pushMatrix();
- translate(0,-r3+r4);
- noStroke();
- //stroke(0);
- ellipse(0,0,2*r4,2*r4);
- stroke(0,0,255);
- point(0,0);
- rotate(-rot3);
- rot4=rot3*4;
- rotate(-rot4);
- //circle
- pushMatrix();
- translate(0,-r4+r5);
- noStroke();
- //stroke(0);
- ellipse(0,0,2*r5,2*r5);
- stroke(255,255,0);
- point(0,0);
- popMatrix();
- popMatrix();
- popMatrix();
- popMatrix();
- }
- //press to start animation
- void mousePressed() {
- loop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement