AnimatedTextureFileProvider
Lens Studio v1.0.0+
Inherits from TextureProvider
Description
Controls an animated texture resource. Can be accessed from Texture.control on an animated texture. See also: 2D Animation Guide.
Methods
getCurrentPlayingFrame()
: Number
Returns the index of the frame that is currently playing.
getDuration()
: Number
Returns how long the animation is in seconds.
getFramesCount()
: Number
Returns the number of frames in the animation.
isFinished()
: Boolean
Returns whether the animation is finished playing.
isPaused()
: Boolean
Returns whether the animation is currently paused.
isPlaying()
: Boolean
Returns whether the animation is currently playing.
pause()
: void
Pauses the animation.
pauseAtFrame(Number frameIndex)
: void
Pauses the animation at frame frameIndex
.
play(Number loops, Number offset)
: void
Plays the animation loops
times, starting with an offset of offset
seconds.
playFromFrame(Number frameIndex, Number loops)
: void
Start playing the animation from frame frameIndex
, loops
times.
resume()
: void
Resumes a paused animation from the frame that was last played.
setOnFinish(function(AnimatedTextureFileProvider animatedTexture) eventCallback)
: void
Sets the callback function to be called whenever the animation stops playing.
stop()
: void
Stops the animation.
Properties
isAutoplay
: Boolean
Returns whether the animation was set to automatically play and loop.
isPingPong
: Boolean
If enabled, the animation will alternate between normal and reverse each time it loops.
isReversed
: Boolean
Whether the animation plays in reverse.
track
: IntStepAnimationTrackKeyFramed
The animation track used to control the frame animation.
Inherited Methods
getAspect()
: Number
Returns the texture’s aspect ratio, which is calculated as width / height.
getHeight()
: Number
Returns the height of the texture in pixels.
getWidth()
: Number
Returns the width of the texture in pixels.
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Examples
// Plays an animated sprite
//@input Component.SpriteVisual spriteVisual
var loops = 100;
var offset = 0.0;
var provider = script.spriteVisual.mainPass.baseTex.control;
provider.play(loops, offset);
Still Looking for help?
Visit Support