Controls an animated texture resource. Can be accessed from Texture.control on an animated texture. See also: 2D Animation Guide.

// 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);
interface AnimatedTextureFileProvider {
    duration: number;
    isAutoplay: boolean;
    isPingPong: boolean;
    isReversed: boolean;
    clone(): AnimatedTextureFileProvider;
    getAspect(): number;
    getCurrentPlayingFrame(): number;
    getDuration(): number;
    getFramesCount(): number;
    getHeight(): number;
    getLoadStatus(): LoadStatus;
    getTypeName(): string;
    getWidth(): number;
    isFinished(): boolean;
    isOfType(type: string): boolean;
    isPaused(): boolean;
    isPlaying(): boolean;
    isSame(other: ScriptObject): boolean;
    pause(): void;
    pauseAtFrame(frameIndex: number): void;
    play(loops: number, offset: number): void;
    playFromFrame(frameIndex: number, loops: number): void;
    resume(): void;
    setOnFinish(eventCallback: ((animatedTexture: AnimatedTextureFileProvider) => void)): void;
    stop(): void;
}

Hierarchy (view full)

Properties

duration: number

Length of the animation in seconds.

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.

Methods

  • Returns the texture's aspect ratio, which is calculated as width / height.

    Returns number

  • Returns the index of the frame that is currently playing.

    Returns number

  • Returns how long the animation is in seconds.

    Returns number

  • Returns the number of frames in the animation.

    Returns number

  • Returns the width of the texture in pixels.

    Returns number

  • Returns whether the animation is finished playing.

    Returns boolean

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns whether the animation is currently paused.

    Returns boolean

  • Returns whether the animation is currently playing.

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean

  • Pauses the animation.

    Returns void

  • Pauses the animation at frame frameIndex.

    Parameters

    • frameIndex: number

    Returns void

  • Plays the animation loops times, starting with an offset of offset seconds.

    Parameters

    • loops: number
    • offset: number

    Returns void

  • Start playing the animation from frame frameIndex, loops times.

    Parameters

    • frameIndex: number
    • loops: number

    Returns void

  • Resumes a paused animation from the frame that was last played.

    Returns void

  • Sets the callback function to be called whenever the animation stops playing.

    Parameters

    Returns void

  • Stops the animation.

    Returns void