_TITLE "Thick Line Color Rotation" ' by Charlie Veniot ' π π π Initialization 'outer point increments opi = 25 'center position determines screen width and height cp = opi * 10 'number of lines per screen edge (including only 1 corner ) nlpse = (cp * 2 / opi) 'total number of lines tl = nlpse * 4 'array of colours DIM this_color(1 TO (tl + 1)) FOR i = 1 TO tl this_color(i) = INT(RND*64) + 1 next i ' π π π Main program SCREEN _NEWIMAGE(cp*2+1,cp*2+1, 17) πππanother_cycleπππ: j = 1 FOR i = 0 TO cp * 2 * 4 - 1 STEP opi IF BETWEEN(i, 0, cp*2 - 1) THEN x2 = i : y2 = 0 IF BETWEEN(i, cp*2, cp*4 - 1) THEN x2 = XMAX : y2 = i - cp*2 IF BETWEEN(i, cp*4, cp*6 - 1) THEN x2 = XMAX - (i - cp*4) : y2 = YMAX IF BETWEEN(i, cp*6, cp*8 - 1 ) THEN x2 = 0 : y2 = YMAX - (i - cp*6) LINE (cp,cp) TO (x2,y2), this_color(j) FOR k = i + 1 TO i + opi - 1 IF BETWEEN(k, 0, cp*2 - 1) THEN x2 = k : y2 = 0 IF BETWEEN(k, cp*2, cp*4 - 1) THEN x2 = XMAX : y2 = k - cp*2 IF BETWEEN(k, cp*4, cp*6 - 1) THEN x2 = XMAX - (k - cp*4) : y2 = YMAX IF BETWEEN(k, cp*6, cp*8 - 1 ) THEN x2 = 0 : y2 = YMAX - (k - cp*6) LINE (cp,cp) TO (x2,y2), this_color(j) NEXT k j = j + 1 NEXT i SLEEP 0.05 ' shift the colors; next draw loop will draw lines in same positions, but colors will be shifted, creating the sensation of animation FOR s = tl TO 1 STEP -1 this_color(s+1) = this_color(s) NEXT s this_color(1) = this_color(tl+1) GOTO πππanother_cycleπππ