Inspired by Philippo demo I wrote this ) You can control with the cursor.
-- 'tunnel' mini-demo by Al Rado -- constants, change them for different effects SCR_WIDTH = 240 SCR_HEIGHT = 136 MAX_COLOR = 15 COLOR_SWITCH_PERIOD = 100 COLOR_MOVE_SPEED = 2 SPEED = 1/800 DEVIATION = 150 RECT_STEP = 4 RECT_START_W = 30 RECT_START_H = 15 SIN_COEFF = 0.67 SHIFT_DELTA = 0.03 -- variables shiftX = 0 shiftY = 0 function TIC() if btn(0) then shiftY=shiftY-SHIFT_DELTA end if btn(1) then shiftY=shiftY+SHIFT_DELTA end if btn(2) then shiftX=shiftX-SHIFT_DELTA end if btn(3) then shiftX=shiftX+SHIFT_DELTA end -- calc base variables slowedTime = time()*SPEED rectCount = (SCR_WIDTH - RECT_START_W)/ RECT_STEP -- draw rectangles cls() for i=0, rectCount do stepX = (SCR_WIDTH - RECT_START_W)/ rectCount stepY = (SCR_HEIGHT - RECT_START_H)/ rectCount width = RECT_START_W + i*stepX height = RECT_START_H + i*stepY x = (math.cos(slowedTime) + shiftX) * DEVIATION/i y = (math.sin(slowedTime*SIN_COEFF) + shiftY) * DEVIATION/i color = (i/COLOR_SWITCH_PERIOD - slowedTime*COLOR_MOVE_SPEED)%MAX_COLOR + 1 rectb(SCR_WIDTH/2 + x - width/2, SCR_HEIGHT/2 + y - height/2, width, height, color) end -- additionall draw rectb(0, 0, SCR_WIDTH, SCR_HEIGHT, color) poke(0x3FF8, color) end