Color Cycle
Cycle through the color wheel
Cycles through color wheel at 15 degree intervals every second.
<lsl> // Cycle color each second for every 15 degress around the color wheel // @author: JB Kraft // ------------------------------------------------------------------------ // Jan 28, 2007 - v0.1 orig example code // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// 24 color values, one for each 15 degrees around the color wheel list realcolors = [ <1.000000, 0.000000, 0.000000>, <1.000000, 0.200000, 0.000000>, <1.000000, 0.400000, 0.000000>, <1.000000, 0.501961, 0.000000>, <1.000000, 0.600000, 0.000000>, <1.000000, 0.698039, 0.000000>, <1.000000, 0.800000, 0.000000>, <1.000000, 0.898039, 0.000000>, <1.000000, 1.000000, 0.000000>, <0.800000, 1.000000, 0.000000>, <0.200000, 1.000000, 0.000000>, <0.000000, 0.800000, 0.000000>, <0.000000, 0.698039, 0.400000>, <0.000000, 0.600000, 0.600000>, <0.000000, 0.400000, 0.698039>, <0.000000, 0.200000, 0.800000>, <0.098039, 0.098039, 0.698039>, <0.200000, 0.000000, 0.600000>, <0.250980, 0.000000, 0.600000>, <0.400000, 0.000000, 0.600000>, <0.600000, 0.000000, 0.600000>, <0.800000, 0.000000, 0.600000>, <0.898039, 0.000000, 0.400000>];
// keep time integer g_TIMER = 0; // the offset into the color array integer g_NDX = 0;
// ------------------------------------------------------------------------ // D E F A U L T // ------------------------------------------------------------------------ default {
// --------------------------------------------------------------------
state_entry()
{
}
// --------------------------------------------------------------------
touch_start(integer total_number)
{
// turn the timer on/off
g_TIMER = !g_TIMER;
// cheeky use of flag as timer value
llSetTimerEvent( g_TIMER );
}
// --------------------------------------------------------------------
timer( )
{
if( g_NDX > llGetListLength( realcolors ) - 1) {
g_NDX = 0;
}
llSetColor( llList2Vector( realcolors, g_NDX), ALL_SIDES );
++g_NDX;
}
}
</lsl>