| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- Uses CRT, Graph;
- Const
- otn = 3;
- typeofstar = 5;
- ang1=5;
- ang2=10;
- ang3=15;
- Type TStar = record
- x,y,radius,color,ang : integer;
- end;
- Var
- stars : array [1..1+typeofstar+typeofstar*typeofstar] of Tstar;
- i : integer;
- Procedure GetStars;
- Var
- i,j: integer;
- tmp,tmp2 : integer;
- Begin
- randomize;
- with stars[1] do
- begin
- x := getmaxx div 2;
- y := getmaxy div 2;
- radius := 150;
- inc(ang,5);
- if ang > 360 then ang := ang mod 360;
- end;
- for i := 2 to typeofstar+1 do
- begin
- with stars[i] do
- begin
- tmp :=i*(360 div typeofstar)+stars[1].ang-(180 div typeofstar);
- x := stars[1].x+round(150*cos(Pi*tmp/180));
- y := stars[1].y+round(150*sin((Pi*tmp)/180));
- radius := 70;
- dec(ang,10);
- if ang < 0 then ang := 360+ang;
- for j := (i-1)*typeofstar+2 to (i-1)*typeofstar+2+typeofstar do
- with stars[j] do
- begin
- tmp2 :=j*(360 div typeofstar)+stars[i].ang-(180 div typeofstar);
- x := stars[i].x+round(70*cos(Pi*tmp2/180));
- y := stars[i].y+round(70*sin((Pi*tmp2)/180));
- radius := 35;
- inc(ang,15);
- if ang > 360 then ang := ang mod 360;
- end;
- end;
- end;
- End;
- Procedure INITG;
- Var
- grDriver: Integer;
- grMode: Integer;
- i : integer;
- begin
- grDriver := Detect;
- InitGraph(grDriver, grMode,'');
- for i := 1 to 1+typeofstar+typeofstar*typeofstar do stars[i].color := random(14)+1;
- End;{INITG}
- {------------------------------}
- Procedure Star(x,y,radius,Color,a0: integer);
- Var
- dx,dy,i,a : integer;
- Begin
- SetColor(color);
- MoveTO(x+round((radius div otn)*cos(pi*a0/180)),
- y+round((radius div otn)*sin(pi*a0/180)));
- for i := 1 to typeofstar * 2 do begin
- a := i*(360 div (typeofstar*2))+a0;
- if i mod 2 = 1 then
- begin
- dx := round(radius*cos((Pi*a)/180));
- dy := round(radius*sin((Pi*a)/180))
- end
- else
- begin
- dx := round((radius div otn)*cos((Pi*a)/180));
- dy := round((radius div otn)*sin((Pi*a)/180))
- end;
- LineTo(x+dx,y+dy);
- end;
- End;{Star}
- Begin
- INITG;
- repeat
- cleardevice;
- Getstars;
- for i := 1 to 1+typeofstar+typeofstar*typeofstar do
- star(stars[i].x,stars[i].y,stars[i].radius,stars[i].color,stars[i].ang);
- delay(500);
- until keypressed;
- CloseGraph;
- End.
|