ON TIMER(n) Statement Programming Example Here is a program that draws a polygon every three seconds with a random shape (three to seven sides), size, and location: SCREEN 1 DEFINT A-Z DIM X(6), Y(6) TIMER ON 'Enable timer event trapping. ON TIMER(3) GOSUB Drawpoly 'Draw a new polygon every 'three seconds. PRINT "Press any key to end program" INPUT "Press to start",Test$ DO LOOP WHILE INKEY$ = "" 'End program if any key pressed. END Drawpoly: CLS 'Erase old polygon. N = INT(5 * RND + 2) 'N is random number from 2 to 6. FOR I = 0 TO N X(I) = INT(RND * 319) 'Get coordinates of vertices of Y(I) = INT(RND * 199) 'polygon. NEXT PSET (X(N), Y(N)) FOR I = 0 TO N LINE -(X(I), Y(I)),2 'Draw new polygon. NEXT RETURN