llSetLinkTextureAnim
void llSetLinkTextureAnim(integer LinkNumber, integer Mode, integer Face, integer SizeX, integer SizeY, float Start, float Length, float Rate)Animates a texture on the prim specified by LinkNumber, by setting the texture scale and offset.
Mode is a bitmask of animation options.
Face specifies which object face to animate.
SizeX and SizeY specify the number of horizontal and vertical frames.Start specifes the animation start point.
Length specifies the animation duration.
Rate specifies the animation playback rate.
Parameters
-
LinkNumber(integer) - Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag to effect
-
Mode(integer) - Bitmask of animation options.
-
Face(integer) - Specifies which object face to animate or ALL_SIDES.
-
SizeX(integer) - Horizontal frames (ignored for ROTATE and SCALE).
-
SizeY(integer) - Vertical frames (ignored for ROTATE and SCALE).
-
Start(float) - Start position/frame number (or radians for ROTATE).
-
Length(float) - Specifies the animation duration, in frames (or radians for ROTATE).
-
Rate(float) - Specifies the animation playback rate, in frames per second (must be greater than zero).
Frames are sub-rectangles within a texture. A set of frames with 2 horizontal (SizeX) and 3 vertical (SizeY) means the overall texture is divided into 3 rows of 2 columns of images, each of which is a frame. llSetLinkTextureAnim will animate across these 6, starting with the top left image and going across and down, optionally repeating. If SMOOTH is set, the frames slide smoothly from one to the next; if off, each frame is displayed in turn centered on the face.
Examples
Section titled “Examples”Smooth texture scroll along the horizontal U-axis with looping:
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 1, 1, 1);Smooth texture scroll in the opposite direction:
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 1, 1, -1);Cell animation: divide a texture into 64 cells (8x8) and flip through them left to right, top to bottom:
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | LOOP, ALL_SIDES, 8, 8, 0, 64, 6.4);Rotate a texture counter-clockwise at 2 revolutions per second:
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1, 1, 0, TWO_PI, 2*TWO_PI);Scale a texture larger and smaller:
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 1, 1, 1, 3, 2);Turn off all texture animations:
llSetLinkTextureAnim(LINK_THIS, FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);Caveats
Section titled “Caveats”- You can only have one texture animation on a prim. Calling
llSetLinkTextureAnimmore than once on a prim will reset it.- Calling
llSetLinkTextureAnimagain with exact same values will not reset the animation (a small difference in rate will suffice).
- Calling
- You cannot combine
ROTATEandSCALEflags. SizeXandSizeYare both limited to a range of 0 to 255- Negative sizes behave as if texture repeats were set to 0 and cannot be used to mirror frames.
- Different animation modes override some of the prim’s texture parameters, but others can still be used:
- Texture offsets are ignored in frame-based and
SMOOTHscrolling modes.- Repeats are ignored if
SizeXandSizeYare not 0. - With either of the sizes set to 0,
SMOOTHscrolling will use the prim’s texture repeats. In frame-based animation, there is no meaningful effect.
- Repeats are ignored if
- Texture rotation is ignored in
ROTATEmode. - Texture repeats are ignored in
SCALEmode.
- Texture offsets are ignored in frame-based and
- Selecting and un-selecting a prim with animation will reset the animation from the beginning.
- While a texture animation is active on any face of a prim,
PRIM_NORMALandPRIM_SPECULARare forced to have their repeats, rotations, and offsets match thePRIM_TEXTUREones, even on faces that are not being animated.
- If
Rateis negative, it has the same effect as using theREVERSEflag. However, ifRateis negative and theREVERSEflag is used, they cancel each other out. - If
Lengthis 0, it is considered to beSizeX * SizeYif both are above 0, otherwise 1. - Frames are numbered from left to right, top to bottom, starting at 0.
- Texture animation is a property of the prim—you can remove the script that started the animation, and the prim will remember the settings. However, texture animation is one of the prim properties that are lost when using the shift-drag copy method.
- For Blinn-Phong materials, the texture’s rotation for each side affects the apparent motion. If the texture is rotated 90 degrees in the edit box, the texture may not flow in the direction expected.
- For PBR materials, the Blinn-Phong texture rotation for each side affects the apparent motion, and any Blinn-Phong transform component (such as offsets via
PRIM_TEXTURE) that is not animated will be applied to the PBR material as well. A GLTF material without a GLTF texture transform will animate identically to a Blinn-Phong material. If a GLTF texture transform (such asPRIM_GLTF_BASE_COLOR) is applied, it will be in addition to the Blinn-Phong transform and texture animation, allowing more flexibility.