Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local width, height = term.getSize()
- local llvls = {}
- local damt = 4
- local dskip = 5
- local dmax = 35
- local dith = 30
- local dithd = damt
- local function getDither()
- dith = dith + dithd
- if dith >= dmax then dithd = -(damt) end
- if dith <= -(dmax) then dithd = damt end
- if dith <= dskip and dith >= -(dskip) then
- if dithd == -(damt) then dith = -(dskip)-1
- elseif dithd == damt then dith = dskip+1 end
- end
- return dith/10
- end
- local stcmax = 115
- local stcmin = 75
- local stcamt = 2
- local stc = stcmin
- local stcd = stcamt
- local function getStretch()
- stc = stc + stcd
- if stc >= stcmax then stcd = -(stcamt) end
- if stc <= stcmin then stcd = stcamt end
- return math.max( (stc/10) - 0.5 )
- end
- local offset = 0
- local function draw()
- offset = offset + 0.75
- offset = (offset%width)
- local dither = getDither()
- local stretch = getStretch()
- for x=1,width do
- local lvl = math.max((math.sin((x-offset)/stretch)*(dither))-0.5) + math.floor(height/2)
- local llvl = llvls[x]
- if llvl == nil then llvl = 1 end
- for y=1,height do
- term.setCursorPos(x, y)
- if y >= lvl then term.setBackgroundColor(colors.lightBlue)
- else term.setBackgroundColor(colors.white) end
- if y >= llvl then
- term.setBackgroundColor(colors.blue)
- end
- term.write(" ")
- end
- llvls[x] = lvl
- end
- end
- local pause = 0.05
- local on = true
- local timer = os.startTimer(pause)
- while on do
- local event, p1 = os.pullEvent()
- if event == "timer" and p1 == timer then
- draw()
- timer = os.startTimer(pause)
- elseif event == "key" then
- if p1 == 29 then
- on = false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement