REM Start of BASIC! Program REM mookdraw FN.DEF r() FN.RTN RND()*128+128 FN.END FN.DEF hsv2rgb(hue,saturation,value,r,g,b) LET r=0:g=0:b=0 LET chroma=value*saturation LET hue1=hue/60 LET x=chroma*(1-ABS(MOD(hue1, 2)-1)) IF (hue1 >= 0 & hue1 <= 1) r1=chroma:g1=x:b1=0 ELSE if (hue1 >= 1 & hue1 <=2) r1=x: g1=chroma:b1=0 ELSE if (hue1 >= 2 & hue1 <=3) r1=0:g1=chroma:b1=x ELSE if (hue1 >= 3 & hue1 <=4) r1=0: g1=x:b1=chroma ELSE if (hue1 >= 4 & hue1 <=5) r1=x:g1=0:b1=chroma ELSE if (hue1 >= 5 & hue1 <=6) r1=chroma:g1=0:b1=x ENDIF LET m=value-chroma LET r=r1+m:LET g=g1+m:LET b=b1+m LET r=255*r LET g=255*g LET b=255*b FN.END FN.DEF randcolor() !gr.color 100,r(),r(),r() hsv2rgb(RND()*360,1,1,&r,&g,&b) GR.COLOR 200,r,g,b FN.END GR.open 255,0,0,0,0,1 GR.SCREEN aw,ah list.create n,oldx list.create n,oldy w=600:h=800 GR.SET.ANTIALIAS 0 GR.SCALE aw/w,ah/h GR.SET.STROKE h/30 DO GR.TOUCH t,x,y if t x*=w/aw:y*=h/ah list.add oldx,x list.add oldy,y endif list.size oldx,z IF z>3 LET hue=MOD(hue+1,360) CALL hsv2rgb(hue,1,1,&r,&g,&b) GR.COLOR 200,r,g,b,1 list.get oldx,1,ox list.get oldy,1,oy gr.line p,ox,oy,x,y list.remove oldx,1 list.remove oldy,1 ENDIF if t & !ot gr.cls:ox=0:oy=y list.clear oldx list.clear oldy endif let ot=t LET ox=x:LET oy=y PAUSE 5 gr.render UNTIL 0