Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Fading alpha in and out

Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
01-24-2007 04:51
I'm trying to get the effect of something fading in and out of existence using this:

CODE

float a = 1.0
do
{
llSetAlpha(a, ALL_SIDES) ;
a = a - 0.1 ;
llSleep(0.1) ;
} while (a > 0 )


and

CODE

float a = 0.0
do
{
llSetAlpha(a, ALL_SIDES) ;
a = a + 0.1 ;
llSleep(0.1) ;
} while (a < 1.0 )


However, I'm not getting totality in either direction, only about 90-95%. What's going wrong, please?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-24-2007 05:16
Its 10% out, or 1 iteration.
In your code you increment the variable and then test it, so when it reaches the limit it is tested and exits without the llSetAlpha call being made. try using <= and >=
Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
01-24-2007 06:20
Aha. Thanks, Newgate! (And I remember our chat a long time ago).
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
01-24-2007 06:39
What Newgate said should work, also another work around would be to use -0.1 and 1.1 instead of 0.0 and 1.0.