uses crt, graph;
var gd,gm:integer;
    n,i,j,x,r,x1,y1:integer;
    u:real;
begin clrscr;
      write('введите количество спиц ');
      readln(n);
      gd:=detect;
      initgraph(gd,gm,'');
      u:=0; r:=50;
      setfillstyle(4,6);
      bar(0,351,639,361);
      bar(0,351,10,60);
      bar(639,361,629,60);
      repeat
      for x:=65 to 580 do
      begin
           setcolor (14);
           circle(x,300,r);
           u:=u+Pi/180;
           for j:=1 to n do
           begin
           x1:=x+trunc(r*cos(u));
           y1:=300+trunc(r*sin(u));
           line(x,300,x1,y1);
           u:=u+2*Pi/n
           end;
           delay(500);
           setcolor(0);
           circle(x,300,r);
           for j:=1 to n do
           begin
           x1:=x+trunc(r*cos(u));
           y1:=300+trunc(r*sin(u));
           line(x,300,x1,y1);
           u:=u+2*Pi/n
           end;
      end;
          for x:=580 downto 60 do
      begin
           setcolor (14);
           circle(x,300,r);
           u:=u+Pi/180;
           for j:=1 to n do
           begin
           x1:=x+trunc(r*cos(u));
           y1:=300-trunc(r*sin(u));
           line(x,300,x1,y1);
           u:=u+2*Pi/n
           end;
           delay(500);
           setcolor(0);
           circle(x,300,r);
           for j:=1 to n do
           begin
           x1:=x+trunc(r*cos(u));
           y1:=300-trunc(r*sin(u));
           line(x,300,x1,y1);
           u:=u+2*Pi/n
           end;
           end;
      until keypressed;
      closegraph;
end.