Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Animated Buttons

revochen Mayne
...says
Join date: 14 Nov 2006
Posts: 198
06-01-2008 05:57
I thought about some nice ways to animate buttons at HUDs or other objects like vendors
and figured out a few ways to do.
Depending on what type of button it can be scaled, rotated or animated more advanced using the llSetTextureAnimation function and custom texture for.
First of hopefully more coming scripts will simply scale a touchd button and fades out befor changing back to default size and transparency.

Feel free to improve, upgrade a/o downgrad the script to your needs ^

watch the short movie for on my website at http://tinyurl.com/3qk45a

CODE

// button scale script
// by revochen June/1/2008



// to use for HUD or other objects buttons

// by sending link messages it may interact with other scripts




vector button_size=<0.01,.05,.05>; // default button size
list buttons=[2,3,4,5]; // list of buttons/prim numbers for

scale(integer prim_nr) // global prim scale function

{
float count;
float alpha;
for(count=0; count<.03; count+=.01)
{
alpha+=.2;

llSetLinkPrimitiveParams(prim_nr,

[PRIM_SIZE,<button_size.x,button_size.y+count,button_size.z+count>,

PRIM_COLOR,ALL_SIDES,<1,1,1>,1.0-alpha]);
}
llSetLinkPrimitiveParams(prim_nr,[PRIM_SIZE,button_size,PRIM_COLOR,ALL_SIDES,<1,1,1>,1]);
}


default
{


state_entry()
{
integer count;
integer max=llGetListLength(buttons);
for(count=0; count<max; ++count)
{
llSetLinkPrimitiveParams(llList2Integer(buttons,count),[PRIM_SIZE,button_size]);
}
}

touch_start(integer total_number)
{

//uncomment next line to make it only for owner usable

if(llDetectedKey(0)!=llGetOwner()) return;

integer link_nr=llDetectedLinkNumber(0);
//llSay(0,(string) link_nr); // uncomment this line to find out a buttons link number


if(llListFindList(buttons,(list)link_nr)!=-1)

{

// send a link message to interact with other scripts

// and trigger other main functions for a specific button

// llMessageLinked();

scale(link_nr);

// maybe you want sound for the buttons

// llPlaySound();

}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
06-04-2008 10:01
:)
_____________________
i've got nothing. ;)
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
06-04-2008 10:21
I'm likin' it... pretty neat.
_____________________
My tutes
http://www.youtube.com/johanlaurasia