Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- pastebin get rXQhBupz circle
- std ld circle-scr circle
- std pb rXQhBupz circle
- --]]
- local sizediv = 1
- local bigno = 16
- local yieldNotSleep = true
- local tArg = {...}
- if tArg[1] == "blittle" then
- sizediv = tArg[2] or sizediv
- bigno = tArg[3] or bigno
- if not fs.exists("blittle") then
- local prog = http.get("http://pastebin.com/raw/ujchRSnU")
- if not prog then
- error("Could not get BLittle API.")
- end
- local file = fs.open("blittle","w")
- file.write(prog.readAll())rXQhBupz
- file.close()
- print("Wrote to 'blittle'")
- end
- else
- sizediv = tonumber(tArg[1]) or sizediv
- bigno = tonumber(tArg[2]) or bigno
- end
- if term.current().setTextScale then term.current().setTextScale(0.5) end
- if (fs.exists("blittle") or blittle) and tArg[1] == "blittle" then
- os.loadAPI("blittle")
- local mon = blittle.createWindow()
- term.redirect(mon)
- scr_x, scr_y = term.getSize()
- end
- local scr_x, scr_y = term.getSize()
- local mx,my = scr_x/2,scr_y/2
- local exitOnMouse = true
- local exitOnButton = true
- local yield = function()
- os.queueEvent("yield")
- os.pullEvent("yield")
- end
- local grayOut = function(color)
- local c = _G.colors
- local grays = {
- [c.white] = c.white,
- [c.orange] = c.lightGray,
- [c.magenta] = c.lightGray,
- [c.lightBlue] = c.lightGray,
- [c.yellow] = c.white,
- [c.lime] = c.lightGray,
- [c.pink] = c.white,
- [c.gray] = c.gray,
- [c.lightGray] = c.lightGray,
- [c.cyan] = c.gray,
- [c.purple] = c.gray,
- [c.blue] = c.gray,
- [c.brown] = c.gray,
- [c.green] = c.gray,
- [c.red] = c.gray,
- [c.black] = c.black,
- }
- local newColor = grays[color] or 1
- return newColor
- end
- local CTB = function(_color) --Color To Blit
- local blitcolors = {
- [colors.white] = "0",
- [colors.orange] = "1",
- [colors.magenta] = "2",
- [colors.lightBlue] = "3",
- [colors.yellow] = "4",
- [colors.lime] = "5",
- [colors.pink] = "6",
- [colors.gray] = "7",
- [colors.lightGray] = "8",
- [colors.cyan] = "9",
- [colors.purple] = "a",
- [colors.blue] = "b",
- [colors.brown] = "c",
- [colors.green] = "d",
- [colors.red] = "e",
- [colors.black] = "f",
- }
- return blitcolors[_color]
- end
- local getColor = function(num)
- if term.isColor() then
- return 2^(math.floor(num)%16)
- else
- return grayOut(2^(math.floor(num)%16))
- end
- end
- local spaces = string.rep(" ", scr_x)
- local render = function(dist,xshift,yshift)
- local lines = {}
- term.current().setVisible(false)
- for y = 1, scr_y do
- local line = {}
- for x = 1, scr_x do
- local thing = (math.sqrt((((x+xshift)-mx)^2)+(((y+yshift)-my)^2))+((dist/bigno)*(16*sizediv)))/sizediv
- line[x] = CTB(getColor(thing))
- end
- lines[y] = table.concat(line)
- end
- for y = 1, scr_y do
- term.setCursorPos(1,y)
- term.blit(spaces, spaces, lines[y])
- end
- term.current().setVisible(true)
- end
- local doAnimation = function()
- local mult = 0
- while true do
- for a = 1, bigno do
- render(a, (math.sin((a+(bigno*mult))/20)*(mx*0.8))+(math.cos((a+(bigno*mult))/30)*(mx/12)), ((math.cos((a+(bigno*mult))/20)*my)+(math.sin((a+(bigno*mult))/35)*(my/9))))
- if yieldNotSleep then
- yield()
- else
- sleep(0)
- end
- end
- mult = mult + 1
- end
- end
- local waitForInput= function()
- while true do
- local evt = os.pullEvent()
- if (evt == "char" and exitOnButton) or (evt == "mouse_click" and exitOnMouse) then
- return
- end
- end
- end
- parallel.waitForAny(waitForInput,doAnimation)
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement