グラフィックデモ

 投稿者:しばっち  投稿日:2013年 8月31日(土)21時18分15秒
  RANDOMIZE
LET N=40
DIM X(N),Y(N),DX(N),DY(N)
CALL GINIT(XSIZE,YSIZE)
FOR I=1 TO N
   LET X(I)=RND*XSIZE
   LET Y(I)=RND*YSIZE
   LET DX(I)=RND*5-2.5
   LET DY(I)=RND*5-2.5
NEXT I
DO
   FOR I=1 TO N
      LET X(I)=X(I)+DX(I)
      LET Y(I)=Y(I)+DY(I)
      LET DY(I)=DY(I)+.1
      IF X(I)<0 OR X(I)>XSIZE THEN LET DX(I)=-DX(I)
      IF Y(I)<0 OR Y(I)>YSIZE THEN LET DY(I)=-DY(I)
   NEXT I
   CALL BOXFULL(0,0,XSIZE-1,YSIZE-1,0)
   FOR I=1 TO N
      IF Y(I)<0 AND DY(I)<0 THEN
         LET Y(I)=RND*YSIZE
         LET DY(I)=RND*5-2.5
      END IF
      CALL LINE(X(I),Y(I),X(I)-DX(I),Y(I)-DY(I),7)
   NEXT I
   WAIT DELAY 1/100
LOOP
END

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
 

グラフィックデモ

 投稿者:しばっち  投稿日:2013年 8月31日(土)21時18分51秒
  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
 

戻る