Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (Martin_HH, steyr, alibaba), 509 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
progressive alpha #81544
07/15/06 00:25
07/15/06 00:25
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline
Senior Expert
ulillillia  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline OP
User
Marky Mark  Offline 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.
Page 1 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1