/* The light Table
*
* Table layout:
* { fadeTime, holdtime, Red intensity, Green intensity, Blue Intensity}
*/
lightTab = [
[ 0, 2500, 255, 0, 0 ],
[ 2500, 0, 0, 255, 0 ],
[ 0, 2500, 0, 120, 0 ],
[ 2500, 0, 0, 255, 98 ],
[ 0, 2500, 0, 0, 255 ],
[ 2500, 0, 0, 120, 0 ]
];
function showColor(red, green, blue)
{
document.getElementById("leddisplay").style.backgroundColor="rgb(" + red + "," + green + "," + blue + ")";
}
function runShow(i)
{
if (i < lightTab.length)
{
holdTime = lightTab[i][0];
fadeTime = lightTab[i][1];
red = lightTab[i][2];
green = lightTab[i][3];
blue = lightTab[i][4];
showColor(red, green, blue);
//setTimeout("runShow(" + (i + 1) + ")", holdTime);
setTimeout(function () {runShow(i + 1);}, holdTime);
}
}
/*
* Assign a listener to start the play back
*/
function assignListeners() {
document.getElementById("play").addEventListener("click", function() { runShow(0); }, true);
}