AS Alpha Animation

From Second Life Wiki
Revision as of 10:39, 18 June 2012 by Silent Mole (talk | contribs) (Created page with "<lsl> →‎Show one piece of a linkset at a time, in the order specified.: // The names of the linkset pieces in the (looping) order you want them shown. list ORDER = [ "A", …")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<lsl> /*

  Show one piece of a linkset at a time, in the order specified.
  • /

// The names of the linkset pieces in the (looping) order you want them shown. list ORDER = [ "A", "B", "C" ]; // linkset ID numbers in order list frames; // current position in the frames list integer current_frame = 0;

list ListLinked(list Needles) {

   integer Prims = llGetNumberOfPrims()+1;
   while(--Prims) {
       integer Ptr = llListFindList(Needles,[llGetLinkName(Prims)]);
       if(~Ptr) Needles = llListReplaceList(Needles,[Prims],Ptr,Ptr);
   }
   return Needles;

}

SetFrame( integer frame ) {

   llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES);
   llSetLinkAlpha( frame, 1.0, ALL_SIDES);

}

default {

   state_entry() {
       frames = ListLinked( ORDER );
       llSetTimerEvent ( 1.0 );
   }
   
   timer() {
       if (current_frame >= llGetListLength(frames)) current_frame = 0;
       
       SetFrame(llList2Integer(frames, current_frame));
       ++current_frame;
   }

} </lsl>