Skip to content
lsl.devlsl.devLSL Dev

LlSetLinkTextureAnim

Looking for the current API? Open the llSetLinkTextureAnim reference →

Wiki description

Animate the texture on the specified face/faces of the specified prim/prims by setting the texture scale and offset. Identical to llSetTextureAnim except able to modify any prim in the link set.

Function notes

Frames are numbered from left to right, top to bottom, starting at 0.
If rate is negative, it has the same effect as using the REVERSE flag.Though if rate is negative and the REVERSE flag is used, they cancel each other out.
If length is 0, it is considered to be sizex*sizey if both are above 0, otherwise 1.

Specification

Frames

Frames are sub-rectangles within the 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.
Modes Description
ANIM_ON1Texture animation is on. This must be set to start the animation, cleared to stop it.
LOOP2Loop the texture animation.
REVERSE4Play animation in reverse direction.
PING_PONG8Play animation going forwards, then backwards.
SMOOTH16Slide in the X direction, instead of playing separate frames.
In both SCALE and ROTATE modes, causes smooth transitions.
ROTATE32Animate texture rotation.
Does not work with SCALE
SCALE64Animate the texture scale.
Does not work with ROTATE

Caveats

  • You can only have one texture animation on a prim.
    • Calling llSetLinkTextureAnim more than once on a prim will reset it.
    • Calling llSetLinkTextureAnim again with exact same values will not reset animation (a small difference in rate will suffice).
  • You cannot combine ROTATE and SCALE flags.
  • sizex and sizey are 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 SMOOTH scrolling modes.
      • Repeats are ignored if sizex and sizey are not 0.
      • With either of the sizes set to 0, SMOOTH scrolling will use the prim's texture repeats. In frame-based animation, there is no meaningful effect.
    • The texture rotation is ignored in ROTATE mode.
    • Texture repeats are ignored in SCALE mode
  • Selecting and un-selecting a prim with animation will reset animation from beginning.
  • While a texture animation is active on any face of a prim, PRIM_NORMAL and PRIM_SPECULAR are forced to have their repeats, rotations and offsets to match the PRIM_TEXTURE ones, even on faces that are not being animated.
  • As of server version 2025-09-03.17442317385, this prim property is maintained when copying in-world.

Examples

This slides a texture smoothly, along the horizontal U-axis, and loops it when it gets to the end.
For Blinn-Phong materials, the texture's rotation for each side affects the apparent motion. So if the texture is rotated 90 degrees by use of 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 (for example the offsets argument of PRIM_TEXTURE) which is not animated will be applied to the PBR material as well. Thus, a GLTF material without a GLTF texture transform will animate identically to a Blinn-Phong material. If a GLTF texture transform (for example PRIM_GLTF_BASE_COLOR) is applied, it will be in addition to the Blinn-Phong transform and texture animation. This allows for more flexibility, however a more complex GLTF texture transform will not loop as easily.
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, 1);
This slides a texture smoothly, along the horizontal U-axis, in the opposite direction
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, -1);
This divides a texture into 64 "cells", 8 across, and 8 down, and flips through them, left to right, top to bottom. This is useful for cell animation.
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | LOOP, ALL_SIDES, 8, 8, 0, 64, 6.4 );
This rotates a texture counter-clockwise at 2 revolutions per second. Change the last value to -2*TWO_PI to rotate clockwise.
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES,1,1,0, TWO_PI, 2*TWO_PI);
This scales a texture larger and smaller.
llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 1, 1, 1, 3, 2);
This turns off all texture animations
llSetLinkTextureAnim(LINK_THIS, FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);

Notes

Texture animation is a property of the prim (i.e., you can remove the script that started the animation, and the prim will remember the settings anyway.)

See also: functions

History

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/link

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}
{{#switch:{{#if:{{{nc|}}}|Template|{{NAMESPACE}}}}|Template=|User=|}}}}

<includeonly>
{{#ifeq:{{#var:article-type}}|event||{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{LSLC|Link{{#var:lang}}}}{{#if:{{{mode|}}}|{{LSLC|Link/{{{mode}}}{{#var:lang}}}}}}
}}}}}}
</includeonly>

{{#if:{{{nlf|}}}{{{noconst|}}}{{#var:link_constants}}||
{{#vardefine:constants_nb|
{{{!}} style={{{ostyle|}}}
{{!}}- valign="top"
{{!}}
{{{!}} {{Prettytable|style=margin-top:0;}}
{{!}}-{{Hl2}}
! colspan="2" {{!}}Flag
!Description
{{!}}-
{{!}} {{LSL Const|LINK_ROOT|integer|1|c={{{verb|refers to}}} the root prim in a multi-prim linked set}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} the [[Link#Root_Prim|root]] prim in a multi-prim linked set{{Footnote|handle=LINK_ROOT|LINK_ROOT does not work on single [[prim]] [[object|objects]]. Unless there is an avatar sitting on the [[object]].}}
{{#if:{{{nogroup|}}}||{{!}}-
{{!}} {{LSL Const|LINK_SET|integer|-1|c={{{verb|refers to}}} all prims}}
{{!}} {{#var:value}}
{{!}} {{#var:comment}}
{{!}}-
{{!}} {{LSL Const|LINK_ALL_OTHERS|integer|-2|c={{{verb|refers to}}} all other prims}}
{{!}} {{#var:value}}
{{!}} {{#var:comment}}}}
{{!}}}
{{!}}
{{{!}} {{Prettytable|style=margin-top:0;}}
{{!}}-{{Hl2}}
! colspan="2" {{!}}Flag
!Description
{{!}}-
{{#if:{{{nogroup|}}}||{{!}} {{LSL Const|LINK_ALL_CHILDREN|integer|-3|c={{{verb|refers to}}} all children, (everything but the root)}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} all children, (everything but the [[Link#Root_Prim|root]])}}
{{!}}-
{{!}} {{LSL Const|LINK_THIS|integer|-4|c={{{verb|refers to}}} the prim the script is in}}
{{!}} {{#var:value}}
{{!}} {{{verb|refers to}}} the [[prim]] the [[script]] is in
{{!}}}
{{!}}}
{{#var:constants_nb}}}}
{{#vardefine:link_constants|*}}
}}

{{#vardefine:p_{{{1|}}}_desc|[[Link]] number ({{#if:{{{nounlinked|}}}||0: {{HoverText|unlinked|When an object is made up of only one prim, and there are no avatars seated upon it, the link number of the (root) prim is zero.}},&#32;}}1: {{HoverText|[[Link#Root_Prim|root]] prim|When an object is made up of multiple prims or there is an avatar seated upon the object, the root prim's link number is one}}, &gt;1: child prims{{#if:{{{noavatar|}}}||&#32;and {{HoverText|seated avatars|Avatars sitting on objects are assigned link numbers. They are always greater than prim link numbers.}}}}) {{#if:{{{nlf|}}}||or a <code>LINK_*</code> [[flag]]}}{{{2|}}}&#32;}}
{{#vardefine:p_{{{1|}}}_hover|Link number ({{#if:{{{nounlinked|}}}||0: unlinked,&#32;}}1: root prim, &gt;1: child prims{{#if:{{{noavatar|}}}||&#32;and seated avatars}}) {{#if:{{{nlf|}}}||or a LINK_* flag}}{{#if:{{{3|}}}|{{{3|}}}|{{{2|}}}}}&#32;}}

{{#if:{{{nocaveats|}}}||{{#if:{{{noavatar|}}}|
{{#vardefine:caveats|
*{{LSLP|{{{1|}}}}} cannot be a {{HoverText|seated avatar|Avatars sitting on objects are assigned link numbers. They are always greater than link numbers of prims.}}.
{{#var:caveats}}}}
}}{{#if:{{{nogroup|}}}|
{{#vardefine:caveats|
*{{LSLP|{{{1|}}}}} needs to be either an actual [[llGetLinkNumber|link number]] or a link constants that equate to a single prim, such as [[LINK_ROOT]] and [[LINK_THIS]].
**[[LINK_SET]], [[LINK_ALL_CHILDREN]] and [[LINK_ALL_OTHERS]] will not work.
{{#var:caveats}}}}
}}}}

{{#if:{{#var:link_stuff}}||
{{#vardefine:link_stuff|*}}
{{#vardefine:notes|
<h3>Link Numbers</h3>
Each prim that makes up an [[object]] has an address, a link number. To access a specific [[prim]] in the [[object]], the [[prim]]'s link number must be known. In addition to [[prim|prims]] having link numbers, avatars seated upon the [[object]] do as well.
* If an [[object]] consists of only one [[prim]], and there are no avatars seated upon it, the ([[Link#Root_Prim|root]]) [[prim]]'s link number is zero.
* However, if the [[object]] is made up of multiple prims or there is an avatar seated upon the [[object]], the [[Link#Root_Prim|root]] [[prim]]'s link number is one.

When an avatar sits on an [[object]], it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without [[llUnSit|unseating]] all avatars first.
<h4>Counting Prims & Avatars</h4>
There are two functions of interest when trying to find the number of prims and avatars on an object.
* <code>[[llGetNumberOfPrims]]()</code> - Returns the number of [[prim|prims]] and seated avatars.
* <code>[[llGetObjectPrimCount]]([[llGetKey]]())</code> - Returns only the number of [[prim|prims]] in the [[object]] but will return zero for attachments.

<syntaxhighlight lang="lsl2">integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}</syntaxhighlight>See [[llGetNumberOfPrims]] for more about counting prims and avatars.

<h4>Errata</h4>
If a script located in a [[Link#Child_Prim|child]] prim erroneously attempts to access link 0, it will get or set the property of the linkset's [[Link#Root_Prim|root]] prim.  This bug ({{jira|BUG-5049}}) is preserved for broken legacy scripts. {{PBR}}
{{#var:notes}}
}}

{{#vardefine:also_functions|{{#var:also_functions}}
{{LSL DefineRow||[[llGetLinkNumber]]|Returns the link number of the [[prim]] the script is in.}}}}
}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|}}}_desc}}
|-
{{VarPairTable|also_functions}}
|-
{{VarPair|constants_nb}}
|-
{{VarPair|notes}}
|}
</noinclude>

Template:LSL Function/face

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}{{#if:{{{nc|}}}{{#pos:{{#var:moded}}|r}}||{{#switch:{{NAMESPACE}}|Template=|User=|[[Category:LSL Face{{#var:lang}}]][[Category:LSL Face{{#var:lang}}/{{#if:{{{return|}}}{{{returns|}}}|Get|Set}}]]}}}}}}

{{#vardefine:ALL_SIDES|{{LSL Const|ALL_SIDES|integer|-1|hex=0xFFFFFFFF}}}}

{{#vardefine:p_{{{1|none}}}_desc|{{LSLGC|Face{{#var:lang}}|face}} number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or {{#var:ALL_SIDES}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|face number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or ALL_SIDES (-1)}}}}

{{#ifeq:{{{notall|}}}|*||{{#vardefine:facechoise|If {{LSLP|{{{1|none}}}}} is {{#var:ALL_SIDES}} then the {{#if:{{{2|}}}|{{{2|}}}|function}} {{#if:{{{get|}}}|{{{get|}}}|{{#if:{{{ALL_SIDES|}}}|{{{ALL_SIDES|}}}|works on all sides.}}}}}}}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{#if:{{{!footer|}}}||{{PBR}}
{{#var:facechoise}}{{PBR}}}}}}

{{#vardefine:caveats|{{#var:caveats}}{{#if:{{{!footer|}}}|
*{{#var:facechoise}}|}}{{#if:{{{return|}}}{{{returns|}}}|
*If {{LSLP|{{{1|none}}}}} indicates a face that does not exist the {{#if:{{{2|}}}|{{{2|}}}}} {{#if:{{{return|}}}|return is {{{return|}}}| returns {{{returns|}}}}}|
*The {{#if:{{{2|}}}|{{{2|}}}|function}} silently fails if its {{LSLP|{{{1|none}}}}} value indicates a face that does not exist.}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|ALL_SIDES}}
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPair|facechoise}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|}
</noinclude>

Template:Issues/SVC-3925

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-3925|Some persistent prim properties lost when duplicated|type=bug}}

Template:Issues/SVC-1242

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-1242|Texture Animation is not copied (llSetTextureAnim)|type=bug}}

Template:Issues/VWR-4018

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|VWR-4018|[[llSetTextureAnim|Texture animations]] ignore repeats per [[face]]|type=bug}}

Template:LSLPT

Original shared helper source (conditional wiki logic is not evaluated)
{{#if:{{#var:p_{{{1|}}}_desc}}{{#var:p_{{{1|}}}_hover}}{{{3|}}}|<span class="lsl-parameter" title="{{#if:{{#var:p_{{{1|}}}_hover}}|{{#var:p_{{{1|}}}_hover}}|{{#var:p_{{{1|}}}_desc}}}}{{{3|}}}" style="border-bottom:1px dotted; cursor:help; font-weight:bold;">{{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}</span>|<span class="lsl-parameter" style="font-weight:bold;">{{#if:{{{2|}}}|{{{2|}}}|{{{1|}}}}}</span>}}<noinclude>
{{{{PAGENAME}}|Test}}<br/>
{{{{PAGENAME}}|Test|Testy}}
{{#vardefine:p_Test_desc|Tested}}
{{{{PAGENAME}}|Test}}<br/>
{{{{PAGENAME}}|Test|Testy}}
{{#vardefine:p_Test_hover|Tested twice}}
{{{{PAGENAME}}|Test}}<br/>
{{{{PAGENAME}}|Test|Testy}}</noinclude>

Template:LSL Function/negative index

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>
Format:
<nowiki>{{LSL Function/negative index|boolean|p1|p2|p3}}</nowiki><br/>
Exclude p1, p2, or p3 if not used.

{{#vardefine:also_articles|{{LSL DefineRow||Test}}}}
{{#vardefine:ni_mode|true}}
{{#vardefine:ni_nc|}}
{{#vardefine:ni_p1|number}}
{{#vardefine:ni_p2|p2}}
<!--{{#vardefine:ni_p3|p3}}-->

</noinclude>{{#if:

{{#vardefine:ni_c|{{#if:{{{2|{{#var:ni_p1}}}}}|{{#if:{{{3|{{#var:ni_p2}}}}}|{{#if:{{{4|{{#var:ni_p3}}}}}|3|2}}|1}}|0}}}}

{{#vardefine:t|{{#ifeq:{{{1|{{#var:ni_mode}}}}}|true|{{#switch:{{#var:ni_c}}|3|2=LSL_Function/negative_index/range|1=LSL_Function/negative_index/single}}}}}}

{{{{#var:t}}|{{{2|{{#var:ni_p1}}}}}|{{{3|{{#var:ni_p2}}}}}|{{{4|{{#var:ni_p3}}}}}|noExclude={{{noExclude|}}}}}

{{#if:{{{noSpec|}}}||
{{#vardefine:spec|{{#var:spec}}
{{#if:{{#var:t}}|
{{{!}} {{Prettytable|style=float:left;}}
{{!}}-{{Hl2}}
! Index
! Positive
! Negative
{{!}}-
{{!}} First
{{!}} <code>0</code>
{{!}} <code>-{{{length|length}}}</code>
{{!}}-
{{!}} Last
{{!}} <code>{{{length|length}}} - 1</code>
{{!}} <code>-1</code>
{{!}}}
=== Indexes ===
<div style="display:table;"><div style="display:block;">
*Positive indexes count from the beginning, the first item being indexed as <code>0</code>, the last as <code>({{{length|length}}} - 1)</code>.
</div></div>
<div style="display:table;"><div style="display:block;">
*Negative indexes count from the far end, the first item being indexed as <code>-{{{length|length}}}</code>, the last as <code>-1</code>. 
</div></div>
}}
}}
}}

{{#vardefine:also_articles|{{#var:also_articles}}
{{#if:{{#var:t}}|{{LSL_DefineRow||{{LSLGC|Negative_Index{{#var:lang}}|Negative Index}}|}}}}}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{PBR}}
{{#vardefineecho:ni_ps|{{#switch:{{#var:ni_c}}
  |0=This function
  |1={{LSLP|{{{2}}}}}
  |2={{LSLP|{{{2}}}}} & {{LSLP|{{{3}}}}}
  |3={{LSLP|{{{2}}}}}, {{LSLP|{{{3}}}}} & {{LSLP|{{{4}}}}}
 }}}} {{#if:{{#var:t}}| support{{#ifexpr:{{#var:ni_c}}>1||s}}| ''do{{#ifexpr:{{#var:ni_c}}>1||es}} not'' support }} {{LSLGC|Negative_Index{{#var:lang}}|negative indexes}}.{{PBR}}
}}

{{#vardefine:footer|{{#var:footer}}
{{#if:{{#var:t}}|{{#ifeq:{{NAMESPACE}}|Template||{{#if:{{#var:self}}{{{self|}}}{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Negative Index{{#var:lang}}}}}}}}|
{{#if:{{#var:self}}{{{self|}}}{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Positive_Index_Only{{#var:lang}}}}}}
}}}}

{{#vardefine:caveats|{{#var:caveats}}
{{#if:{{{nc|{{#var:ni_nc}}}}}||
* If {{#switch:{{#var:ni_c}}
 |3=either {{LSLP|{{{2}}}}}, {{LSLP|{{{3}}}}} or {{LSLP|{{{4}}}}} are
 |2=either {{LSLP|{{{2}}}}} or {{LSLP|{{{3}}}}} are
 |1={{LSLP|{{{2}}}}} is}} out of bounds {{#if:{{{oob-return|}}}|this function returns {{{oob-return|}}} and}} the script continues to execute without an error message.
{{#if:{{#var:t}}|{{#ifexpr:{{#var:ni_c}}>1|{{#if:{{{noExclude|}}}|* {{LSLP|{{{2}}}}} & {{LSLP|{{{3}}}}} will not form an [[#exclusion_range|exclusion range]] when {{LSLP|{{{2}}}}} is past {{LSLP|{{{3}}}}} (Approximately: {{LSLP|{{{2}}}}} > {{LSLP|{{{3}}}}}), instead it will act as if {{LSLP|{{{2}}}}} was zero & {{LSLP|{{{3}}}}} was -1.|* {{LSLP|{{{2}}}}} & {{LSLP|{{{3}}}}} will form an [[#exclusion_range|exclusion range]] when {{LSLP|{{{2}}}}} is past {{LSLP|{{{3}}}}} (Approximately: {{LSLP|{{{2}}}}} > {{LSLP|{{{3}}}}}). }}}}}}
}}}}

}}<noinclude>
==Debugging==
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|header_footnote}}
|-
{{VarPair|spec}}
|-
{{VarPair|caveats}}
|-
{{VarPair|notes}}
|-
{{VarPair|constants_nb}}
|-
{{VarPairTable|also_articles}}
|-
{{VarPair|footer}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.