|
|
progressive alpha
#81544
07/15/06 00:25
07/15/06 00:25
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
how to do a model appear progressivly? I have a model and I want it to take 30 sec before reaching 100 of alpha... how to do this?
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81545
07/15/06 00:34
07/15/06 00:34
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Do something like this: Code:
function super_slow_fadein() { var total_time = 0; while(1) { total_time += time; entity.alpha = 48000/total_time; wait(1); } }
The 48000 comes from 30*16*100 as there are 16 ticks in one second and alpha is from 0 to 100. Edit: fixed a mistake I had (not 480, 48,000).
Last edited by ulillillia; 07/15/06 00:40.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81546
07/15/06 00:37
07/15/06 00:37
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
thanks, but what will do the total_time var in this code?
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81547
07/15/06 00:39
07/15/06 00:39
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
total_time adds up the time each frame. At 16, that's 1 second. 1 second means an alpha of 3.333. I need to correct the code so it's 48000 instead (alpha isn't 0 to 1, but 0 to 100 and that's why). You know that 15 seconds is half of 30 and half transparent is 50%.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81548
07/15/06 00:51
07/15/06 00:51
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I tried it like this: Code:
function super_slow_fadein() { var total_time = 0; while(1) { total_time += time; my.alpha = 960/total_time; //480 = nb de sec * 16 tick in 1 sec wait(1); } }
action formation { super_slow_fadein(); } I changed entity.alpha to my.alpha cause acknex got an error on running. I made this simple action, and attached it to my model. Maybe its important to know that my model is a cloud, so I used alpha channels on many "frames" of the cloud.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81549
07/15/06 00:59
07/15/06 00:59
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
30 seconds would use 48000 for that first number - it was a mistake that I made. 96000 would be one whole minute. Also, the while loop should have "while(my.alpha < 100)" instead. If you want this as an entity action, use this instead: Code:
action super_slow_fadein() { my.skill1 = 0; while(my.alpha < 100) { my.skill1 += time; my.alpha = 96000/my.skill1; wait(1); } my.alpha = 100; // full opacity is set only when while loop becomes false }
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81550
07/15/06 01:12
07/15/06 01:12
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Aight I tried and nothing happens to my model. its staying at 100 of alpha. I tried puttin my.alpha=0; before the loop, but i still get no result
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81551
07/15/06 01:14
07/15/06 01:14
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Did you, by chance, set the transparent flag? Add this as the first line within the action:
my.transparent = on;
Setting the alpha has no effect if the transparent flag is not on.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: progressive alpha
[Re: ulillillia]
#81552
07/15/06 01:15
07/15/06 01:15
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
-_- rofl shame on me.. lets try it
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: progressive alpha
[Re: Marky Mark]
#81553
07/15/06 01:16
07/15/06 01:16
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Do I have to set my skill1 to something? (its not working :/ )
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|