Difference between revisions of "FadeEasy"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '{{LSL Header}} '''FadeEasy''' == Introduction == FadeEasy makes object fading easier for you to make an object fade in or out simply by entering a one line code. '''Example:''' l...')
 
Line 7: Line 7:


== Usage ==
== Usage ==
<math>Function: llFade(integer linknumber, float AlphaStart, float AlphaEnd, integer faces, float speed);
{Function: llFade(integer linknumber, float AlphaStart, float AlphaEnd, integer faces, float speed);
integer linknumber –  Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag
integer linknumber –  Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag
float AlphaStart –  from 0.0 (clear) to 1.0 (solid), This is the starting opacity of your object
float AlphaStart –  from 0.0 (clear) to 1.0 (solid), This is the starting opacity of your object
float AlphaEnd –  from 0.0 (clear) to 1.0 (solid), This is the ending opacity of your object
float AlphaEnd –  from 0.0 (clear) to 1.0 (solid), This is the ending opacity of your object
integer faces - LINK_THIS, LINK_ROOT, LINK_SET, LINK_ALL_OTHERS, LINK_ALL_CHILDREN
integer faces - LINK_THIS, LINK_ROOT, LINK_SET, LINK_ALL_OTHERS, LINK_ALL_CHILDREN
float speed - How much opacity to gain or decrease by</math>
float speed - How much opacity to gain or decrease by
}


== Function Code ==
== Function Code ==

Revision as of 05:39, 10 September 2009

FadeEasy

Introduction

FadeEasy makes object fading easier for you to make an object fade in or out simply by entering a one line code. Example: llFade(LINK_SET, 0.0, 1.0, ALL_SIDES, 0.05); Or llFade(LINK_SET, 1.0, 0.0, ALL_SIDES, 0.05);


Usage

{Function: llFade(integer linknumber, float AlphaStart, float AlphaEnd, integer faces, float speed); integer linknumber – Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag float AlphaStart – from 0.0 (clear) to 1.0 (solid), This is the starting opacity of your object float AlphaEnd – from 0.0 (clear) to 1.0 (solid), This is the ending opacity of your object integer faces - LINK_THIS, LINK_ROOT, LINK_SET, LINK_ALL_OTHERS, LINK_ALL_CHILDREN float speed - How much opacity to gain or decrease by }

Function Code

<math> // Leave this part alone! llFade(integer linknumber, float AlphaStart, float AlphaEnd, integer faces, float speed) {

   if(AlphaStart<AlphaEnd)
   {
       for(;AlphaStart<AlphaEnd;)
       {
           AlphaStart+=speed;
           llSetLinkAlpha(linknumber, AlphaStart, faces);
       }
       return;
   }
   else if(AlphaStart>AlphaEnd)
   {
       for(;AlphaStart>AlphaEnd;)
       {
           AlphaStart-=speed;
           llSetLinkAlpha(linknumber, AlphaStart, faces);
       }
       return;
   }

}</math>

Entire Example Code

<math> // Leave this part alone! llFade(integer linknumber, float AlphaStart, float AlphaEnd, integer faces, float speed) {

   if(AlphaStart<AlphaEnd)
   {
       for(;AlphaStart<AlphaEnd;)
       {
           AlphaStart+=speed;
           llSetLinkAlpha(linknumber, AlphaStart, faces);
       }
       return;
   }
   else if(AlphaStart>AlphaEnd)
   {
       for(;AlphaStart>AlphaEnd;)
       {
           AlphaStart-=speed;
           llSetLinkAlpha(linknumber, AlphaStart, faces);
       }
       return;
   }

}

// Global Integer Varibles integer faded;

//==== default {

   on_rez(integer params)
   {
       llFade(LINK_SET, 0.0,1.0,ALL_SIDES,0.05);
       faded = TRUE;
   }
   touch_end(integer num_detected)
   {
       if(faded == TRUE)
       {
           faded = FALSE;
           llFade(LINK_SET, 1.0,0.0, ALL_SIDES, 0.05);
       }
   }

}</math>