Please login or register.

Login with username, password and session length
Advanced search  


IRC channel - server:  channel: #wme (read more)

Author Topic: FadeThrough method  (Read 3827 times)

0 Members and 1 Guest are viewing this topic.


  • 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)
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));



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

Page created in 0.119 seconds with 22 queries.