Difference between revisions of "LlSetTextureAnim"

From Second Life Wiki
Jump to navigation Jump to search
m (What is a frame, no repeats or rotations)
(A detailed description of frames is too complex for the summary. Not sure if it belongs in spec or notes... leaning towards spec.)
Line 12: Line 12:
|p6_type=float|p6_name=length|p6_desc=number of frames to display (or radians for [[ROTATE]])
|p6_type=float|p6_name=length|p6_desc=number of frames to display (or radians for [[ROTATE]])
|p7_type=float|p7_name=rate|p7_desc=frames per second (must not be zero)
|p7_type=float|p7_name=rate|p7_desc=frames per second (must not be zero)
|func_footnote=Frames are numbered from left to right, top to bottom, starting at 0.<br/>
|func_footnote=Frames are numbered from left to right, top to bottom, starting at 0.
'''Frames''' are sub-rectangles within the texture. A set of frames with 2 horizontal and 3 vertical means the overall texture is divided into 3 rows of 2 columns of images, each of which is a frame. llSetTextureAnim 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.
<br/>If '''rate''' is negative, it has the same effect as using the [[REVERSE]] flag.{{Footnote|Though if '''rate''' is negative and the [[REVERSE]] flag is used, they cancel each other out.}}
<br/>If '''rate''' is negative, has the same effect as using the [[REVERSE]] flag.
|func_desc=Animate the texture on the specified face/faces by setting the texture scale and offset.
|func_desc=Animate the texture on the specified face/faces by setting the texture scale and offset.
|return_text
|return_text
|spec
|spec=
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. llSetTextureAnim 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.
|caveats=*You can only have one texture animation on a prim
|caveats=*You can only have one texture animation on a prim
**Calling llSetTextureAnim more than once on a prim will reset it.
**Calling llSetTextureAnim more than once on a prim will reset it.
*You cannot combine ROTATE and SCALE
*You cannot combine [[ROTATE]] and [[SCALE]] flags.
*'''sizex''' & '''sizey''' are both limited to a range of 0 to 255
*'''sizex''' & '''sizey''' are both limited to a range of 0 to 255
*llSetTextureAnim when on shows the texture with 1 repeat in X and Y and 0 rotation and offset.
*llSetTextureAnim when on shows the texture with 1 repeat in X and Y and 0 rotation and offset.

Revision as of 01:02, 19 December 2008

Summary

Function: llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

Animate the texture on the specified face/faces by setting the texture scale and offset.

• integer mode mask of Mode flags
• integer face face number or ALL_SIDES
• integer sizex horizontal frames (ignored for ROTATE and SCALE)
• integer sizey vertical frames (ignored for ROTATE and SCALE)
• float start Start position/frame number (or radians for ROTATE)
• float length number of frames to display (or radians for ROTATE)
• float rate frames per second (must not be zero)

start supports negative indexes. If face is ALL_SIDES then the function works on all sides. 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.[1]

Specification

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. llSetTextureAnim 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_ON 0x01 Texture animation is on. This must be set to start the animation, cleared to stop it.
LOOP 0x02 Loop the texture animation.
REVERSE 0x04 Play animation in reverse direction.
PING_PONG 0x08 Play animation going forwards, then backwards.
SMOOTH 0x10 Slide in the X direction, instead of playing separate frames.
In both SCALE and ROTATE modes, causes smooth transitions.
ROTATE 0x20 Animate texture rotation.
Does not work with SCALE
SCALE 0x40 Animate the texture scale.
Does not work with ROTATE

Caveats

  • If start is out of bounds the script continues to execute without an error message.
  • The function silently fails if its face value indicates a face that does not exist.
  • You can only have one texture animation on a prim
    • Calling llSetTextureAnim more than once on a prim will reset it.
  • You cannot combine ROTATE and SCALE flags.
  • sizex & sizey are both limited to a range of 0 to 255
  • llSetTextureAnim when on shows the texture with 1 repeat in X and Y and 0 rotation and offset.
All Issues ~ Search JIRA for related Bugs

Examples

This slides a texture smoothly and loops it when it gets to the end.

<lsl>llSetTextureAnim(ANIM_ON

See Also

Articles

•  Negative Index

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ Though if rate is negative and the REVERSE flag is used, they cancel each other out.

Signature

function void llSetTextureAnim( integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );