scriding

Rainbow Illumintator

Jan 20th, 2021 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. r = 255              --Starts at pure RED
  2. g = 0
  3. b = 0
  4. c = peripheral.wrap("top")
  5.  
  6.  
  7. repeat  --this loop goes 0-255 in Green
  8.  
  9.         form = string.format("%02x%02x%02x", r, g, b)
  10.         sub = string.gsub(form, ", ", "")
  11.         dec = tonumber(sub, 16)
  12.         c.setColor(dec)
  13.  
  14.         g = g + 1
  15.  
  16.         sleep(.1)
  17. until g == 255
  18.  
  19.  
  20.  
  21.  
  22. repeat  --this loop goes from 255-0 in Red
  23.  
  24.         form = string.format("%02x%02x%02x", r, g, b)
  25.         sub = string.gsub(form, ", ", "")
  26.         dec = tonumber(sub, 16)
  27.         c.setColor(dec)
  28.  
  29.         r = r - 1
  30.  
  31.         sleep(.1)
  32. until r == 0
  33.  
  34.  
  35.  
  36.  
  37. repeat  --this loop goes from 0-255 in Blue
  38.  
  39.         form = string.format("%02x%02x%02x", r, g, b)
  40.         sub = string.gsub(form, ", ", "")
  41.         dec = tonumber(sub, 16)
  42.         c.setColor(dec)
  43.  
  44.         b = b + 1
  45.  
  46.         sleep(.1)
  47. until b == 255
  48.  
  49.  
  50.  
  51.  
  52. repeat  --this loop goes from 255-0 in Green
  53.  
  54.         form = string.format("%02x%02x%02x", r, g, b)
  55.         sub = string.gsub(form, ", ", "")
  56.         dec = tonumber(sub, 16)
  57.         c.setColor(dec)
  58.  
  59.         g = g - 1
  60.  
  61.         sleep(.1)
  62. until g == 0
  63.  
  64.  
  65.  
  66.  
  67. repeat  --this loop goes from 0-255 in Red
  68.  
  69.         form = string.format("%02x%02x%02x", r, g, b)
  70.         sub = string.gsub(form, ", ", "")
  71.         dec = tonumber(sub, 16)
  72.         c.setColor(dec)
  73.  
  74.         r = r + 1
  75.  
  76.         sleep(.1)
  77. until r == 255
  78.  
  79.  
  80.  
  81.  
  82. repeat  --this loop goes from 255-0 in Blue
  83.  
  84.         form = string.format("%02x%02x%02x", r, g, b)
  85.         sub = string.gsub(form, ", ", "")
  86.         dec = tonumber(sub, 16)
  87.         c.setColor(dec)
  88.  
  89.         b = b - 1
  90.  
  91.         sleep(.1)
  92. until b == 0
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
Add Comment
Please, Sign In to add comment