document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. /* The light Table
  3. *
  4. * Table layout:
  5. * { fadeTime, holdtime, Red intensity, Green intensity, Blue Intensity}
  6. */
  7. lightTab = [
  8.   [     0,   2500, 255,   0,   0 ],
  9.   [   2500,     0,   0,   255,   0 ],
  10.   [     0,   2500,   0, 120,   0 ],
  11.   [   2500,     0,   0,   255,   98 ],
  12.   [     0,   2500,   0,   0, 255 ],
  13.   [   2500,     0,   0,   120,   0 ]
  14. ];
  15.  
  16.  
  17. function showColor(red, green, blue)
  18. {
  19.     document.getElementById("leddisplay").style.backgroundColor="rgb(" + red + "," + green + "," + blue + ")";     
  20. }
  21.  
  22.  
  23. function runShow(i)
  24. {
  25.     if (i < lightTab.length)
  26.     {
  27.         holdTime = lightTab[i][0];
  28.         fadeTime = lightTab[i][1];
  29.         red = lightTab[i][2];
  30.         green = lightTab[i][3];
  31.         blue = lightTab[i][4];
  32.         showColor(red, green, blue);
  33.         //setTimeout("runShow(" + (i + 1) + ")", holdTime);
  34.         setTimeout(function () {runShow(i + 1);}, holdTime);
  35.  
  36.     }
  37. }
  38.  
  39.  
  40. /*
  41. * Assign a listener to start the play back
  42. */
  43. function assignListeners() {
  44.  document.getElementById("play").addEventListener("click", function() { runShow(0);  }, true);
  45. }
');