|
LET N1=20
LET N2=40
RANDOMIZE
DIM X(N1),Y(N1),DX(N1),DY(N1)
DIM X2(N2),Y2(N2),DX2(N2),DY2(N2)
CALL GINIT(XSIZE,YSIZE)
FOR I=1 TO N1
LET X(I)=RND*XSIZE
LET Y(I)=RND*YSIZE
LET THETA=ANGLE(X(I)-XSIZE/2,Y(I)-YSIZE/2)
LET DX(I)=COS(THETA)
LET DY(I)=SIN(THETA)
NEXT I
FOR I=1 TO N2
LET X2(I)=RND*XSIZE
LET Y2(I)=RND*YSIZE
LET THETA=ANGLE(X2(I)-XSIZE/2,Y2(I)-YSIZE/2)
LET DX2(I)=COS(THETA)
LET DY2(I)=SIN(THETA)
NEXT I
DO
CALL BOXFULL(0,0,XSIZE-1,YSIZE-1,0)
FOR I=1 TO N1
LET X(I)=X(I)+DX(I)
LET Y(I)=Y(I)+DY(I)
LET DX(I)=DX(I)+DX(I)/10
LET DY(I)=DY(I)+DY(I)/10
IF X(I)<0 OR X(I)>XSIZE OR Y(I)<0 OR Y(I)>YSIZE THEN
LET X(I)=XSIZE/2+RND*50-25
LET Y(I)=YSIZE/2+RND*50-25
LET THETA=ANGLE(X(I)-XSIZE/2,Y(I)-YSIZE/2)
LET DX(I)=COS(THETA)
LET DY(I)=SIN(THETA)
END IF
CALL LINE(X(I),Y(I),X(I)-DX(I),Y(I)-DY(I),7)
NEXT I
FOR I=1 TO N2
LET X2(I)=X2(I)+DX2(I)
LET Y2(I)=Y2(I)+DY2(I)
LET DX2(I)=DX2(I)+DX2(I)/50
LET DY2(I)=DY2(I)+DY2(I)/50
IF X2(I)<0 OR X2(I)>XSIZE OR Y2(I)<0 OR Y2(I)>YSIZE THEN
LET X2(I)=XSIZE/2+RND*50-25
LET Y2(I)=YSIZE/2+RND*50-25
LET THETA=ANGLE(X2(I)-XSIZE/2,Y2(I)-YSIZE/2)
LET DX2(I)=COS(THETA)
LET DY2(I)=SIN(THETA)
END IF
CALL PSET(X2(I),Y2(I),7)
NEXT I
WAIT DELAY 1/100
LOOP
END
EXTERNAL SUB PSET(X,Y,C)
SET POINT COLOR C
PLOT POINTS: X , Y
END SUB
EXTERNAL SUB GINIT(XSIZE,YSIZE)
ASK BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0 , XSIZE , YSIZE, 0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB
EXTERNAL SUB LINE(XS,YS,XE,YE,C)
SET COLOR C
PLOT LINES
PLOT LINES: XS,YS;XE,YE
END SUB
EXTERNAL SUB BOXFULL(X1,Y1,X2,Y2,C)
SET COLOR C
PLOT AREA: X1,Y1;X2,Y1;X2,Y2;X1,Y2;X1,Y1
END SUB
|
|