Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("GIF")
- if term.setTextScale then term.setTextScale(0.5) end
- local x, y = term.getSize()
- local gifs = fs.list("GIFs")
- for i = #gifs, 1 do if gifs[i]:sub(-4):lower() ~= ".gif" then table.remove(gifs, i) end end
- local image = GIF.loadGIF(fs.combine("GIFs", gifs[1]))
- while true do for i = 1, #gifs do
- term.setBackgroundColour(image.backgroundCol)
- term.clear()
- parallel.waitForAny(
- function()
- if x < image.width or y < image.height then
- if x < math.floor(y / image.height * image.width) then
- image = GIF.resizeGIF(image, x)
- else
- image = GIF.resizeGIF(image, nil, y)
- end
- end
- GIF.animateGIF(image, math.floor((x - image.width) / 2) + 1, math.floor((y - image.height) / 2) + 1)
- end,
- function()
- local myTimer = os.startTimer(10)
- while true do
- local myEvent = {os.pullEvent()}
- if (myEvent[1] == "timer" and myEvent[2] == myTimer) or myEvent[1] == "mouse_click" or myEvent[1] == "key" then break end
- end
- image = GIF.loadGIF(fs.combine("GIFs", gifs[(i == #gifs) and 1 or (i + 1)]))
- end
- )
- end end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement