karelvysinka

GIF autoload

Dec 29th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. os.loadAPI("GIF")
  2.  
  3. local mon = peripheral.find("monitor")
  4.  
  5. local gifs = fs.find("*.gif")  -- Note: fs.find() is case-sensitive, even if your file system isn't.
  6.  
  7. mon.setTextScale(0.5)
  8. local x, y = mon.getSize()
  9.  
  10. while true do for i = 1, #gifs do
  11.         local image = GIF.loadGIF(gifs[i])
  12.         mon.setBackgroundColour(image[1].transparentCol or image.backgroundCol)
  13.         mon.clear()
  14.        
  15.         parallel.waitForAny(
  16.                 function()
  17.                         GIF.animateGIF(image, math.floor((x - image.width) / 2) + 1, math.floor((y - image.height) / 2) + 1, mon)
  18.                 end,
  19.                
  20.                 function()
  21.                         sleep(10)
  22.                 end
  23.         )
  24. end end
Add Comment
Please, Sign In to add comment