View Single Post
  #7  
Old 08-31-2007, 10:16 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
This is the script I use for fading on Val Dev, it is to be joined to a Gui Control object.

PHP Code:
//#CLIENTSIDE
enum {
  
M_NONE,
  
M_FADEIN,
  
M_FADEOUT
}
public function 
fadeIn(timetoalpha) {
  if (
this.fademode != M_NONE)
    return;
  
this.fademode M_FADEIN;
  
this.fadeint 0.05 time;
  
this.fadeto toalpha;
  
this.visible true;
  
this.fading true;
  
setTimer(0.05);
}
public function 
fadeOut(timetoalpha) {
  if (
this.fademode != M_NONE)
    return;
  
this.fademode M_FADEOUT;
  
this.fadeint 0.05 time;
  
this.fadeto toalpha;
  
this.visible true;
  
this.fading true;
  
setTimer(0.05);
}
function 
onTimeout() {
  switch (
this.fademode) {
    case 
M_FADEIN:
      
this.alpha += this.fadeint;
      if (
this.alpha >= this.fadeto) {
        
this.fademode M_NONE;
        
this.fading false;
        
setTimer(0);
      }
      else {
        
setTimer(0.05);
      }
      break;
    case 
M_FADEOUT:
      
this.alpha -= this.fadeint;
      if (
this.alpha <= this.fadeto) {
        
this.fademode M_NONE;
        if (
this.fadeto == 0) {
          
this.visible false;
        }
        
this.fading false;
        
setTimer(0);
      }
      else {
        
setTimer(0.05);
      }
      break;
  }

__________________
Reply With Quote