RANDOMIZE TIMER
CLEAR ALL
SCREEN 4
TYPE star
    FIELD angle,speed,distance,color
END TYPE
n=1000
DIM stars(n) AS star
FOR i=1 TO n
    lum=RANGE(75,255)
    stars(i).angle=RND(2*PI)
    stars(i).speed=RND(90)+10
    stars(i).distance=RND(200)+1
    stars(i).color=RGB(lum,lum,lum)
NEXT i
ox=SCREEN.WIDTH/2
oy=SCREEN.HEIGHT/2
DOUBLE BUFFER
DO
    et=ELAPSED.TIME/1000
    IF et>0.1 THEN et=0.1
    FOR i=1 TO n
        stars(i).distance=stars(i).distance+stars(i).speed*et*(stars(i).distance/100)
        IF stars(i).distance>200 THEN
            lum=RANGE(75,255)
            stars(i).angle=RND(2*PI)
            stars(i).speed=RND(90)+10
            stars(i).distance=RND(200)+1
            stars(i).color=RGB(lum,lum,lum)
        END IF
        lum=stars(i).color AND 255
        m=stars(i).distance/100
        INK RGB(lum*m,lum*m,lum*m)
        x=COS(stars(i).angle)*stars(i).distance+ox
        y=SIN(stars(i).angle)*stars(i).distance+oy
        PLOT x,y
    NEXT i
    SWAP BUFFERS CLS
LOOP WHILE INKEY$=""
END
