Advertisement
LDDestroier

Color pattern maker

Jul 19th, 2015
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. -- pastebin get uR8v94ss color
  2. os.pullEvent = os.pullEventRaw
  3. scr_x, scr_y = term.getSize()
  4. seed = math.random(1, 255)
  5. local function rollOver(input, max)
  6.     return math.floor(input % max)
  7. end
  8. local function getColor(input)
  9.     return 2^rollOver(input, 16)
  10. end
  11. term.setBackgroundColor(colors.black)
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. y = 0
  15. bacColor = 1
  16. scrollUp = true
  17. while true do
  18.     if scrollUp then
  19.         term.scroll(1)
  20.         term.setCursorPos(1,scr_y)
  21.     else
  22.         term.scroll(-1)
  23.         term.setCursorPos(1,1)
  24.     end
  25.     for x = 1, scr_x do
  26.         txtColor = getColor(bacColor + seed + y)
  27.         bacColor = getColor((((x + y) - seed) + (y * (seed / 50))) + 100)
  28.         term.setBackgroundColor(bacColor)
  29.         term.setTextColor(txtColor)
  30.         write("#")
  31.     end
  32.     y = y + 1
  33.    
  34.     if scrollUp then
  35.         term.scroll(1)
  36.         term.setCursorPos(1,scr_y)
  37.     else
  38.         term.scroll(-1)
  39.         term.setCursorPos(1,1)
  40.     end
  41.    
  42.     for x = 1, scr_x do
  43.         txtColor = getColor(bacColor + seed + y)
  44.         bacColor = getColor((((x - y) + seed) - (y + (seed * 100))) * 100)
  45.         term.setBackgroundColor(bacColor)
  46.         term.setTextColor(txtColor)
  47.         write("#")
  48.     end
  49.     y = y + 1
  50.    
  51.     if y >= 512 then
  52.         y = 0
  53.         scrollUp = not scrollUp
  54.         seed = math.random(1, 255)
  55.     end
  56.     sleep(0)
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement