Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --demo for pue (paintutils extra)
- -- pastebin get weLUU423 puedemo
- if not fs.exists("pue") then
- print("Downloading PUE...")
- local file = fs.open(fs.combine(fs.getDir(shell.getRunningProgram()),"pue"),"w")
- file.write(http.get("https://pastebin.com/raw/7XAmsAbX").readAll())
- file.close()
- end
- shell.run("pue")
- local tArg = {...}
- local image = tArg[1] and paintutils.autocrop(paintutils.loadImage(tArg[1])) or {{32,32,32,32,32,32,512,512,512,512,512},{32,8192,32,8192,32,8192,2048,2048,512,512,512},{32,8192,8192,8192,32,32,2048,512,512,512,512},{32,8192,32,8192,32,8192,2048,2048,512,2048,512},{32,32,32,32,32,32,512,512,512,512,512}}
- local mon = peripheral.find("monitor")
- if mon then mon.setTextScale(0.5) end
- local scr_x,scr_y = term.getSize()
- --scale image down to highest effective resolution
- local imgXsize, imgYsize = paintutils.getSize(image)
- if imgXsize > scr_x or imgYsize > scr_y then
- if imgXsize < imgYsize then
- image = paintutils.stretchImage(image,scr_x,imgYsize*(scr_x/imgXsize))
- else
- image = paintutils.stretchImage(image,imgXsize*(scr_y/imgYsize),scr_y)
- end
- end
- local fliptest = function()
- local buffer = 1
- local bg = paintutils.fullScreen(colors.black)
- local img
- local objectX,objectY,objectXspeed,objectYspeed = 2, 2, 1, 1
- local objImg
- local objSizeX,objSizeY = 13, 10
- while true do
- buffer = (buffer + 0.05) % 360
- if (objectX >= scr_x-objSizeX) or (objectX <= 1) then
- objectXspeed = objectXspeed * -1
- end
- if (objectY >= scr_y-objSizeY) or (objectY <= 1) then
- objectYspeed = objectYspeed * -1
- end
- objectX = objectX + objectXspeed
- objectY = objectY + objectYspeed
- local bigImgScaleX = math.sin(buffer)*(scr_x-2)
- local bigImgScaleY = math.cos(buffer/3)*(scr_y-2)
- local bigImage = paintutils.centerWithBlankSpace(paintutils.stretchImage(image,bigImgScaleX,bigImgScaleY))
- objImg = paintutils.stretchImage(image,math.cos(buffer*4)*objSizeX,objSizeY)
- img = paintutils.merge({objImg,objectX,objectY}, {bigImage,1,1}, {bg,1,1})
- paintutils.drawImageBlit(img,1,1)
- sleep(0.05)
- end
- end
- fliptest()
- --1+(scr_x/2)-math.abs(bigImgScaleX/2),1+(scr_y/2)-math.abs(bigImgScaleY/2) --old math for centering big image
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement