// Place in contents of a prim. Touch to start or stop
integer ON = FALSE;
integer loop;
float x;
default
{
touch_start(integer total_number)
{
llSetTimerEvent(0.5*(ON = !ON));
loop = 1;
x = 0;
}
timer()
{
if(loop == 1)
{
llSetColor(<1 ,0.2*x,0>,ALL_SIDES);
x = x+0.25;
if (x > 5)
{
loop = 2;
x = 5;
}
}
else if (loop ==2)
{
llSetColor(<0.2*x,1,0>,ALL_SIDES);
x = x-0.25;
if(x <0)
{
loop = 3;
x = 1;
}
}
else if (loop == 3)
{
llSetColor(<0,1.0-(0.2*x),0.2*x>,ALL_SIDES);
x = x+0.25;
if(x > 5)
{
loop = 4;
x = 5;
}
}
else if (loop == 4)
{
llSetColor(<1 .0-(0.2*x),0,1>,ALL_SIDES);
x = x-0.25;
if(x <0)
{
loop = 5;
x = 1;
}
}
else if (loop == 5)
{
llSetColor(<1,0,1.0-(0.2*x)>,ALL_SIDES);
x = x+0.25;
if (x > 5)
{
loop = 1;
x = 0;
}
}
}
}>1>>0>1>