AnimatedImage

The AnimatedImage automates flip-book style animations.

Summary
AnimatedImageThe AnimatedImage automates flip-book style animations.
Implementation DetailsThe AnimatedImage automates change the texture coordinates for a given texture to produce a flip-book style animation.
XML DefinitionThis is the AnimatedImage xml definition.
XML Tag
Optional AttributesThese are optional.
textureName of the Ui Texture to display.
mirrorTexCoordsAllows you to display a horizontal mirror image of the texture.
textureScaleThe scale of the texture to be used for the image artwork.
The textureScale parameter will be ignored if you explictly set the texture dimensionswith the the TexDims elementfunction.
filteringAllows you to specify the blend mode used for this texture when rendering.
fpsThe frames per second at which to play the animation
Elements
AnimFramesThe coordinate infromation for each frame in the animation.
TexDimsThe explicit texture dimenions to use for each frame, regardless of it’s size.
Functions
Functions
AnimatedImageSetTexture()Sets the texture displayed on this image.
AnimatedImageStartAnimation()Starts playing this animation according to the parameters.
AnimatedImageStopAnimation()Stops an active animation.
AnimatedImageSetPlaySpeed()Sets the speed (fps) at which to play the animation.

Implementation Details

The AnimatedImage automates change the texture coordinates for a given texture to produce a flip-book style animation.

Below is an example set of frames for a book page flipping animation.

XML Definition

This is the AnimatedImage xml definition.

Summary
XML Tag
Optional AttributesThese are optional.
textureName of the Ui Texture to display.
mirrorTexCoordsAllows you to display a horizontal mirror image of the texture.
textureScaleThe scale of the texture to be used for the image artwork.
The textureScale parameter will be ignored if you explictly set the texture dimensionswith the the TexDims elementfunction.
filteringAllows you to specify the blend mode used for this texture when rendering.
fpsThe frames per second at which to play the animation
Elements
AnimFramesThe coordinate infromation for each frame in the animation.
TexDimsThe explicit texture dimenions to use for each frame, regardless of it’s size.

XML Tag

<AnimatedImage>
....
</AnimatedImage>

Optional Attributes

These are optional.  You can use whichever apply to the Animated you are creating.

texture

Name of the Ui Texture to display.  All frames for the animations must reside in a single texture.

Expects

A string value, which is the name of a valid ui Texture.

Default Value

  • ””

mirrorTexCoords

Allows you to display a horizontal mirror image of the texture.  This swaps the topleft and bottom left coordinates with those used for the topright and bottomright of the image.

Expects

A boolean value.

”true”Mirror the texture coords
”false”Use normal texture coordinates

Default Value

  • ”false”

textureScale

The scale of the texture to be used for the image artwork.  This is multiplied by the image’s <Size> to determine the texture dimensions.

Expects

A number value.  (1.0 = 100%)

Default Value

  • 1.0

The textureScale parameter will be ignored if you explictly set the texture dimensions

with the the TexDims elementfunction.

filtering

Allows you to specify the blend mode used for this texture when rendering.

Expects

A boolean value.

”true”Use Bilinear Filter filtering.
”false”Use Nearest Neighbor filtering.

Default Value

  • ”true”

fps

The frames per second at which to play the animation

Expects

A number value.  (1.0 = 1 frame per second)

Default Value

  • 1.0

Default Value

  • ”true”

Elements

AnimFrames

The coordinate infromation for each frame in the animation.

Syntax

<AnimFrames>
<AnimFrame id="1" x="0" y="0" />
<AnimFrame id="2" x="342" y="0" />
...
<AnimFrame id="6" x="684" y="328" />
</AnimFrames>
idThe id # of the frame being defined.
xThe x pixel coordinate of the top left of the frame image.
yThe y pixel coordinate of the top left of the frame image.

Defaults

x0
y0

TexDims

The explicit texture dimenions to use for each frame, regardless of it’s size.  When this element is included, any textureScale value will be ignored.

Syntax

<TexDims x="100" y="100" />
xThe x pixel texture size.
yThe y pixel texture size.

Defaults

x0
y0

Functions

Summary
Functions
AnimatedImageSetTexture()Sets the texture displayed on this image.
AnimatedImageStartAnimation()Starts playing this animation according to the parameters.
AnimatedImageStopAnimation()Stops an active animation.
AnimatedImageSetPlaySpeed()Sets the speed (fps) at which to play the animation.

Functions

AnimatedImageSetTexture()

Sets the texture displayed on this image.

Parameters

animatedImageName(string) The name of the AnimatedImage.
texture(string) The name of the ui Texture to display.

Returns

nilno return value

Related XML

Notes

  • none

Example

AnimatedImageSetTexture("SomeAnimatedImage", "some_anim_texture" )

AnimatedImageStartAnimation()

Starts playing this animation according to the parameters.

Parameters

animatedImageName(string) The name of the AnimatedImage.
startFrame(number) The id number of the frame to begin with.
loop(boolean) Should the animation loop?
hideWhenDone(boolean) Should the animation automatically hide when it finishes (Not to be used when looping)?
delay(number) How long to wait before starting the animation.

Returns

nilno return value

Notes

  • With the delay paramter you can set a series of animation to run at once without manually starting each animation in lua at the appropriate time.

Example

AnimatedImageStartAnimation( animWindow, 0, false, true, 0 )

AnimatedImageStopAnimation()

Stops an active animation.

Parameters

animatedImageName(string) The name of the AnimatedImage.

Returns

nilno return value

Notes

  • none

Example

AnimatedImageStopAnimation( animWindow )

AnimatedImageSetPlaySpeed()

Sets the speed (fps) at which to play the animation.

Parameters

animatedImageName(string) The name of the AnimatedImage.
fpsSpeed(string) The play speed in frames per second.

Returns

nilno return value

Related XML

  • <fps.

Notes

  • none

Example

AnimatedImageSetPlaySpeed( "SomeAnimWindow", 12 )
This element defines a single art texture component.
The explicit texture dimenions to use for each frame, regardless of it’s size.
The scale of the texture to be used for the image artwork.
Name of the Ui Texture to display.