Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local gpu = component.gpu
- local w, h = 40, 20
- local ow, oh = gpu.getResolution()
- local brailleindex = {{0x1,0x8},{0x2,0x10},{0x4,0x20},{0x40,0x80}}
- local idfk = 0
- local btn = {[false] = 0, [true] = 1}
- gpu.setResolution(w, h)
- function generatePattern()
- local outputstr = ""
- s = math.sin(idfk)
- c = math.cos(idfk)
- for y=0, h-1 do
- for x=0, w-1 do
- local c = 0
- for sy=0, 3 do
- for sx=0, 1 do
- local i = brailleindex[sy+1][sx+1]
- local tx, ty = x * 2 + sx, y * 4 + sy
- local nx, ny = tx + math.sin(idfk) * 50, ty + math.cos(idfk) * 50 -- math.floor(tx * c - ty * s), math.floor(tx * s + ty * c) -- failed attempt at rotozoom
- local p = math.floor(math.sin(nx/4)+math.cos(ny/4)) % 2
- c = c + p * i
- end
- end
- outputstr = outputstr .. unicode.char(0x2800+c)
- end
- end
- return outputstr
- end
- while true do
- io.write(generatePattern())
- idfk = idfk + 0.025
- if event.pull(0.01, "interrupted") == "interrupted" then
- gpu.setResolution(ow, oh)
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement