Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- local filename = tArg[1]
- getPicDetails = function(picture)
- local top, bottom, left, right
- for a = 1, #picture do
- if #picture[a] > 0 then
- top = a
- break
- end
- end
- for a = 1, #picture do
- if #picture[#picture-(a-1)] > 0 then
- bottom = #picture-(a-1)
- break
- end
- end
- left, right = 10000, 0
- for a = 1, #picture do
- for b = 1, #picture[a] do
- if picture[a][b] then
- if picture[a][b] ~= 0 then
- if b < left then
- left = b
- end
- if b > right then
- right = b
- end
- end
- end
- end
- end
- return top, bottom, left, right, math.floor((left+right)/2), math.floor((bottom+top)/2)
- end
- skewImage = function(pic,xrotate,yrotate,cenX,cenY) --0 is normal
- local newPic = {}
- local picTop,picBot,picLeft,picRight,centerX,centerY = getPicDetails(pic)
- centerX = cenX or centerX
- centerY = cenY or centerY
- for y = 1, #pic do
- if pic[y] then
- newPic[math.floor(((y)*math.cos(yrotate or 0))+centerY)] = {}
- for x = 1, #pic[y] do
- if pic[y][x] then
- newPic[math.floor(((y)*math.cos(yrotate or 0))+centerY)][math.floor(((x)*math.cos(xrotate or 0))+centerX)] = pic[y][x]
- end
- end
- end
- end
- return newPic
- end
- if not filename then
- return print(fs.getName(shell.getRunningProgram()).." <nfp file>")
- end
- paint = paintutils.loadImage(filename)
- term.setBackgroundColor(colors.black)
- term.clear()
- local scr_x, scr_y = term.getSize()
- while true do
- for a = 1, 360 do
- local pickcher = skewImage(paint,a,0)
- paintutils.drawImage(pickcher,scr_x/2,scr_y/2)
- sleep(0.1)
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement