transparency

Posted By: NL_3DGS_n00b

transparency - 07/01/06 20:34

I have a script which changes the alpha of an panel.
It fades good, but after 1 fade, it stops... Until I recall the function...
I want it to loop so it fades continious...

Can somebody help me?
This is the script:
Code:
function 1st_flash() {

while(pan_1st_flash.alpha < 60) {
pan_1st_flash.alpha = min(60,(pan_1st_flash.alpha + 2 * time));
wait(1);
}
while(pan_1st_flash.alpha > 20) {
pan_1st_flash.alpha = max(20,(pan_1st_flash.alpha - 2 * time));
wait(1);
}
}


Posted By: NL_3DGS_n00b

Re: transparency - 07/01/06 21:27

Fixed:

Code:
function 1st_flash() {
while(1){
while(pan_1st_flash.alpha < 60) {
pan_1st_flash.alpha = min(60,(pan_1st_flash.alpha + 2 * time));
wait(1);
}
while(pan_1st_flash.alpha > 20) {
pan_1st_flash.alpha = max(20,(pan_1st_flash.alpha - 2 * time));
wait(1);
}
}
}


Posted By: vlau

Re: transparency - 07/01/06 21:30

Code:

var alphaValue;

function 1st_flash()
{
if (pan_1st_flash.alpha > 60)
{
alphaValue = -2;
}

if (pan_1st_flash.alpha < 20)
{
alphaValue = 2;
}

pan_1st_flash.alpha += alphaValue * time;
}

function main()
{
level_load(...);
//.....
while(1)
{
1st_flash();
wait(1);
}
}



As always, not tested, let me know if it won't work.

Edit
----
Ok, just ignore it if you find your solution.

© 2023 lite-C Forums