0010  // Clip demo
0020
0030 USE UNIGRAPHICS
0040
0050 graphicscreen(0)
0060 clear
0070 window(-10,100,-10,100)
0080 axes
0090 graph(2)
0100 WHILE key$="" DO WAIT
0110 remove_graph
0120 WHILE key$="" DO WAIT
0130 graph(5)
0140 WHILE key$="" DO WAIT
0150 textscreen
0160  //
0170
0180 PROC axes
0190   moveto(0,0)
0200   FOR y:=0 TO 90 STEP 10 DO
0210     draw(0,10);draw(-2,0);move(2,0)
0215     plottext(-6,y,str$(y))
0220   ENDFOR y
0230   moveto(0,0)
0240   FOR x:=0 TO 90 STEP 10 DO
0250     draw(10,0);draw(0,-2);move(0,2)
0255     plottext(x,-8,str$(x))
0260   ENDFOR x
0270 ENDPROC axes
0280  //
0290 PROC graph(a)
0300   moveto(0,f(a,0))
0310   FOR x:=0 TO 100 DO
0320     drawto(x,f(a,x))
0330   ENDFOR x
0340 ENDPROC graph
0350  //
0360 FUNC f(a,x)
0370   RETURN abs(sin(x/a)*x/a)
0380 ENDFUNC f
0390  //
0400 PROC remove_graph
0410   clip(0+pixelx,100,0+pixely,100)
0420   clear
0430 ENDPROC remove_graph
