Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: FadeThrough method  (Read 3564 times)

0 Members and 1 Guest are viewing this topic.

Igorrr

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • Ugh...Ughugh!!!!!!
    • View Profile
    • Struggle For Life And Honour
FadeThrough method
« on: April 28, 2004, 08:36:53 PM »

I don't know for whom it may be of interested. For the Day / Night transition I need to be able to "fade through".
I am fading from day to dusk to night, so I need a way to fade from dusk to night directly without having the day pop up in the middle.
So I wrote this little method:

The parameters are:

ftime = The amount of timeRedGreenBlueAlphaRedGreenBlueAlpha Value you want to fade into.

e.g. FadeThrough(10000,80,0,40,60,20,0,30,180);

Note: There is a certain time overhead in this method. Fading Through with 0ms still takes almost 7s and 10000ms around 5s to fade through on my machine.

Code: [Select]
method FadeThrough(ftime,fro,fgo,fbo,fao,frn,fgn,fbn,fan)
{
//Settings
var fsteps= 200; //The steps the fade method uses.

// variables
var i; // for the for loop.
var stime = ToInt(ftime/fsteps); // time slice for each step
var frstep = (frn-fro)/fsteps; // step value for red colour
var fgstep = (fgn-fgo)/fsteps; // step value for green colour
var fbstep = (fbn-fbo)/fsteps; // step value for blue colour
var fastep = (fan-fao)/fsteps; // step value for alpha colour

for (i=1;i<=fsteps;i=i+1)
{
fro = fro+frstep;
fgo = fgo+fgstep;
fbo = fbo+fbstep;
fao = fao+fastep;

//Game.Msg("Step: "+i+" - current values: "+ToInt(fro)+" - "+ToInt(fgo)+" - "+ToInt(fbo)+" - "+ToInt(fao));
//Game.LOG("Step: "+i+" - current values: "+ToInt(fro)+" - "+ToInt(fgo)+" - "+ToInt(fbo)+" - "+ToInt(fao));


Scene.FadeOut(0,ToInt(fro),ToInt(fgo),ToInt(fbo),ToInt(fao));
Sleep(stime);

}
Scene.FadeOut(0,frn,fgn,fbn,fan);

}
« Last Edit: April 29, 2004, 07:37:40 PM by Igorrr »
Logged
 

Page created in 0.152 seconds with 22 queries.