With this code the wheel (conveyor) of the layout fades when you stop moving it.
What I want to do is that, between the fact that the wheel stopped moving and that it started to disappear, it will be x milliseconds.
first_tick <- 0;
stop_fading <- true;
my_delay <- 600;
function wheel_a_fade_transition(ttype, var, ttime)
{
if(ttype == Transition.ToNewSelection)
first_tick = -1;
}
fe.add_transition_callback("wheel_a_fade_transition");
function wheel_a_alpha(ttime)
{
if(first_tick == -1)
{
stop_fading = false;
}
if(!stop_fading)
{
local elapsed = 0;
if(first_tick > 0)
{
elapsed = ttime - first_tick;
}
local count = conveyor.m_objs.len();
for(local i=0; i < count; i++)
{
if(elapsed > 0)
{
if(i == count/2)
{
conveyor.m_objs[i].alpha =(255 *(my_delay - elapsed)) / my_delay;
}
else
{
conveyor.m_objs[i].alpha =(150 *(my_delay - elapsed)) / my_delay;
}
}
}
if(elapsed > my_delay)
{
stop_fading = true;
}
if(first_tick == -1)
{
first_tick = ttime;
}
}
}
fe.add_ticks_callback("wheel_a_alpha");
Any suggestions?