void setup (){ background(255); size(400,300); frameRate(20); } float theta=0; float a=radians(57.1); int ang=0; float x=100*cos (theta); float y=40*sin (theta); float phi=atan2(140-y,140-x); float leng=sqrt(sq(140-y)+sq(140-x)); float leng1=142.5; void draw (){ fill(255); rect(0,0,400,300); fill(0); noFill(); x=100*cos (theta); y=40*sin (theta); phi=atan2(160-y,130-x); leng=sqrt(sq(160-y)+sq(130-x)); ellipse(150,230,200,80); line(176.5,230,176.5+250*cos(a),230-250*sin(a)); line(295,46.8,260,210); line(295,46.9,330,250); pushMatrix(); translate(280,70); rotate(PI-phi); line(leng,0,leng-leng1,0); line(0,2,leng1,2); line(0,-2,leng1,-2); popMatrix(); ang=(ang+5)%360; theta=radians(ang); }