Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: code I made up to handle texture animations

BigJohn Jade
Registered User
Join date: 5 Aug 2003
Posts: 93
11-16-2006 06:56
// By BigJohn Jade
// New Texture Animation engine (2009)
// This script is free from Elite Technology

///////////////////////////////////
// How to make textures animations
//////////////////////////////////
// Things you will need for this.

// 1. Adobe Photoshop version 7.0 or better.
/////////////////////////////////////////////

// 1. Load PS and make a new image at 1024x1024

// Go to edit, then Preferences, then Guides, Grid, Slices & Count and where it says Gridline every. Change this to 256 and make sure it is set on pixels, next to it, you will see the pull down box, the Subdivisions should be 1. Now go to view and turn on Extars and you will see 16 cells and each cell is 256x256 and comes out to 16 frames.

// You do not have to use all the 16 frames if you dont want to. Change the SetLength to how many frames you are using.

// Once you are done with the picture just upload it to sl. When you got it all uploaded just right, click the image and copy asset uuid. You can now just paste the uuid where it says On_UUID_Texture=. For the off mode texture just do same but make sure it is still image only.

CODE

// Club Elite, The Pit UUID texture key
string On_UUID_Texture="e8b37308-ccf3-51e2-48f7-0c84cbcba7a4";

// Off Mode default UUID texture key
string Off_UUID_Texture="334bab25-00dd-4e8c-ef53-bbf7d16d1f45";

integer FACE_SIDE = ALL_SIDES; // Face side of the object to show on
integer TextureAnimationOn = TRUE; // Animation is on by default

integer Off_Mode = FALSE; // Off Mask Mode
integer SetSizeX = 4; // horizontal frames
integer SetSizeY = 4; // vertical frames
float SetStart = 0.0; // Start position/frame number
float SetLength = 16.0; // 16 frames
float SetRate = 5.0; // frames per second

// New function for setting texture animation by BigJohn Jade
SetTextureAnim(integer Modes, integer ObjFace, string UUIDTexture, integer SizeX, integer SizeY, float Start, float Length, float Rate)
{
llSetTexture(UUIDTexture,ObjFace);
llSetTextureAnim(Modes,ObjFace,SizeX,SizeY,Start,Length,Rate);
}

// Turns off the Texture Animation and sets the off mode texture.
TurnAnimOff()
{
SetTextureAnim(Off_Mode,FACE_SIDE,Off_UUID_Texture, 0, 0, 0.0, 0.0, 1.0);
}

default
{
state_entry()
{
if(TextureAnimationOn)
{
llSetColor(<1,1,1>,FACE_SIDE);
SetTextureAnim(ANIM_ON | LOOP,FACE_SIDE,On_UUID_Texture, SetSizeX, SetSizeY,SetStart, SetLength, SetRate);
return;
}
if(!TextureAnimationOn)
{
llSetColor(<0,0,0>,FACE_SIDE);
TurnAnimOff();
llSetColor(<1,1,1>,FACE_SIDE);
}
}
on_rez(integer i)
{
if(TextureAnimationOn)
{
SetTextureAnim(ANIM_ON | LOOP,FACE_SIDE,On_UUID_Texture, SetSizeX, SetSizeY,SetStart, SetLength, SetRate);
return;
}
if(!TextureAnimationOn)
{
llSetColor(<0,0,0>,FACE_SIDE);
TurnAnimOff();
llSetColor(<1,1,1>,FACE_SIDE);
}
}
// If you want to use the linkmessage event
/////////////////////////////////////////////////////////////////
// For on: llMessageLinked(LINK_SET,TRUE,"TURN TEXTURE ANIMATION ON",NULL_KEY);
// For Off: llMessageLinked(LINK_SET,FALSE,"TURN TEXTURE ANIMATION OFF",NULL_KEY);
/////////////////////////////////////////////////////////////////

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "TURN TEXTURE ANIMATION OFF")
{
TextureAnimationOn = (integer)num;
llSetColor(<0,0,0>,FACE_SIDE);
TurnAnimOff();
llSetColor(<1,1,1>,FACE_SIDE);
}
if (str == "TURN TEXTURE ANIMATION ON")
{
TextureAnimationOn = (integer)num;
llSetColor(<0,0,0>,FACE_SIDE);
SetTextureAnim(ANIM_ON | LOOP,FACE_SIDE,On_UUID_Texture, SetSizeX, SetSizeY,SetStart, SetLength, SetRate);
llSetColor(<1,1,1>,FACE_SIDE);
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
11-16-2006 08:22
_____________________
i've got nothing. ;)
hurly Burleigh
Registered User
Join date: 19 Sep 2005
Posts: 167
11-19-2006 10:54
OK DO YOU HAVE AN ENGLISH TRANSLATION FOR THE ABOVE.

i have no idea what you were trying to explain.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump and funniness
09-24-2008 05:29
You can view the original discussion thread at:
_____________________
i've got nothing. ;)
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
09-24-2008 17:59
Nice work Bigjohn.

For those that try this on a new prim and don't see anything, side 5 is the underside face of an unrotated prim.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
BigJohn Jade
Registered User
Join date: 5 Aug 2003
Posts: 93
I update the Code
09-24-2008 18:37
Thanks. :)

I update the code so just need change one line for face number of prim now.

integer FACE_SIDE = 5;

From: Kornscope Komachi
Nice work Bigjohn.

For those that try this on a new prim and don't see anything, side 5 is the underside face of an unrotated prim.