REM Start of BASIC! Program rem demos for virtual reality VR goggles rem by cterp starcount=100 DIM speed[starcount] DIM birect[ starcount] DIM radius[ starcount ] DIM o[starcount] DIM o2[starcount] DIM newx[starcount] DIM newx2[starcount] DIM newy[starcount] DIM oldx[starcount] DIM oldx2[starcount] DIM oldy[starcount] fn.def r() fn.rtn floor(rnd()*100)+80 fn.end pi = ATAN(1) * 4 GR.OPEN 255, 0, 0, 0, 0 GR.ORIENTATION 0 GR.SCREEN mx, my LIST.CREATE S,CLIST LIST.ADD CLIST,"squares","stars","letters","quit" do dialog.select c,clist,"choose VR demo" bkhit=0 gr.cls IF C=1 gosub squares ELSE IF C=2 gosub starfield ELSE IF C=3 gosub alpha ENDIF until c=4 exit alpha: GR.COLOR 255, 255, 255, 255 ,1 GR.SET.STROKE 3 LET midx = mx / 4 LET midx2= 3*mx/4 LET midy = my / 2 LET maxrad = midx LET dd=60 WAKELOCK 3 FOR I = 1 TO starcount LET speed[I] = (RND() + 0.1) / 100 LET birect[I] = (RND() * 2 * pi) LET radius[I] = RND() let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I]) *newrad+midy GR.COLOR 255,r(),r(),r(),255 GR.SET.STROKE 2*rnd()+1 !GR.POINT o[i],newx[i],newy[i] c$=chr$(ascii("a")+rnd()*26) gr.text.size rnd()*30+5 gr.text.draw o[i],newx[i],newy[i],c$ gr.text.draw o2[i],newx2[i],newy[i],c$ !GR.POINT o2[i],newx2[i],newy[i] let oldx[i]=newx[i]:let oldx2[i]=newx2[i]:let oldy[i]=newy[i] NEXT GR.RENDER DO FOR I=1 TO starcount IF radius[I]>=1 LET speed[I] = (RND() + 0.1) / 100 LET birect[I] = RND() * (2 * pi) LET radius[I]= RND() / 300 ELSE LET radius[I]+=speed[I]:LET newrad=radius[I]^2*maxrad ENDIF let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I])*newrad+midy GR.MOVE o[i],newx[i]-oldx[i],newy[i]-oldy[i] GR.MOVE o2[i],newx2[i]-oldx2[i],newy[i]-oldy[i] let oldx[i]=newx[i] let oldx2[i]=newx2[i] let oldy[i]=newy[i] GR.MODIFY o[i],"alpha",radius[I]*255 GR.MODIFY o2[i],"alpha",radius[I]*255 NEXT GR.RENDER UNTIL bkhit return starfield: GR.COLOR 255, 255, 255, 255 ,1 GR.SET.STROKE 3 LET midx = mx / 4 LET midx2= 3*mx/4 LET midy = my / 2 LET maxrad = midx LET dd=40 WAKELOCK 3 FOR I = 1 TO starcount LET speed[I] = (RND() + 0.3) / 100 LET birect[I] = (RND() * 2 * pi) LET radius[I] = RND() let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I]) *newrad+midy GR.COLOR 255,r(),r(),r(),255 GR.SET.STROKE 1*rnd()+3 GR.POINT o[i],newx[i],newy[i] GR.POINT o2[i],newx2[i],newy[i] let oldx[i]=newx[i]:let oldx2[i]=newx2[i]:let oldy[i]=newy[i] NEXT GR.RENDER DO FOR I=1 TO starcount IF radius[I]>=1 LET speed[I] = (RND() + 0.3) / 100 LET birect[I] = RND() * (2 * pi) LET radius[I]= RND() / 300 ELSE LET radius[I]+=speed[I]:LET newrad=radius[I]^2*maxrad ENDIF let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I])*newrad+midy GR.MOVE o[i],newx[i]-oldx[i],newy[i]-oldy[i] GR.MOVE o2[i],newx2[i]-oldx2[i],newy[i]-oldy[i] let oldx[i]=newx[i] let oldx2[i]=newx2[i] let oldy[i]=newy[i] GR.MODIFY o[i],"alpha",radius[I]*255 GR.MODIFY o2[i],"alpha",radius[I]*255 NEXT GR.RENDER UNTIL bkhit return squares: GR.COLOR 255, 255, 255, 255 ,1 GR.SET.STROKE 3 LET midx = mx / 4 LET midx2= 3*mx/4 LET midy = my / 2 LET maxrad = midx LET dd=60 WAKELOCK 3 FOR I = 1 TO starcount LET speed[I] = (RND() + 0.1) / 100 LET birect[I] = (RND() * 2 * pi) LET radius[I] = RND() let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I]) *newrad+midy GR.COLOR 255,r(),r(),r(),255 GR.SET.STROKE 40*rnd()+5 GR.POINT o[i],newx[i],newy[i] GR.POINT o2[i],newx2[i],newy[i] let oldx[i]=newx[i]:let oldx2[i]=newx2[i]:let oldy[i]=newy[i] NEXT GR.RENDER DO FOR I=1 TO starcount IF radius[I]>=1 LET speed[I] = (RND() + 0.1) / 100 LET birect[I] = RND() * (2 * pi) LET radius[I]= RND() / 300 ELSE LET radius[I]+=speed[I]:LET newrad=radius[I]^2*maxrad ENDIF let newx[i]=COS(birect[I])*newrad +midx let newx2[i]=COS((1+radius[i]/dd)*birect[I])*newrad +midx2 let newy[i]=SIN(birect[I])*newrad+midy GR.MOVE o[i],newx[i]-oldx[i],newy[i]-oldy[i] GR.MOVE o2[i],newx2[i]-oldx2[i],newy[i]-oldy[i] let oldx[i]=newx[i] let oldx2[i]=newx2[i] let oldy[i]=newy[i] GR.MODIFY o[i],"alpha",radius[I]*255 GR.MODIFY o2[i],"alpha",radius[I]*255 NEXT GR.RENDER UNTIL bkhit return ongrtouch: bkhit=1 gr.ongrtouch.resume OnError: GR.CLOSE END