Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local time, period, updateTimer, draw
- time = 0
- period = 0.05
- updateTimer = os.startTimer(period)
- local rainbow
- do
- local _with_0 = colors
- rainbow = {
- _with_0.black,
- _with_0.red,
- _with_0.orange,
- _with_0.yellow,
- _with_0.green,
- _with_0.blue,
- _with_0.purple,
- _with_0.black
- }
- end
- draw = function()
- do
- local _with_0 = term
- local w, h = term.getSize()
- for x = 1, w do
- for i = 1, #rainbow do
- _with_0.setBackgroundColor(rainbow[i])
- for y = i * 3 - 2, i * 3 do
- y = y + (math.sin(x / 15 + time) * 3)
- _with_0.setCursorPos(x, y)
- _with_0.write(' ')
- end
- end
- end
- return _with_0
- end
- end
- while true do
- local _, timer = os.pullEvent('timer')
- if timer == updateTimer then
- draw()
- time = time + 0.5
- updateTimer = os.startTimer(period)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment