Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CODE --
- local glassesTerminal = peripheral.warp("back")
- drawBoxGradient(5,5,20,15, 0.6,0,0,0, 0.3,0,0,0)
- function drawBox(xPos, yPos, width, height, color, opacity)
- glassesTerminal.addBox(xPos, yPos, width, height, color, opacity)
- end
- function drawBoxGradient(xPos, yPos, width, height, FO,FR,FG,FB, TO,TR,TG,TB)
- local I = 1
- while I <= height do
- local rgbcolor = {}
- rgbcolor["r"] = math.ceil((FR - TR)) / height * I + FR
- rgbcolor["g"] = math.ceil((FG - TG)) / height * I + FG
- rgbcolor["b"] = math.ceil((FB - TB)) / height * I + FB
- glassesTerminal.addBox(xPos, yPos + I, width, 1,rgbToHex(rgbcolor) , math.ceil((FO - TO)) / height * I + FO)
- I = I +1
- end
- end
- local function rgbToHex(c)
- local output = decToHex(c["r"]) .. decToHex(c["g"]) .. decToHex(c["b"]);
- return "0x" .. output
- end
Advertisement
Add Comment
Please, Sign In to add comment