Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: AnimatedTexture

[21:7] extends: Texture

Wraps FXGL's AnimatedTexture (com.almasb.fxgl.texture.AnimatedTexture), the Texture subclass that drives a sprite-sheet animation through one or more AnimationChannels. Constructed from a default AnimationChannel; additional channels can be swapped in at runtime via playAnimationChannel / loopAnimationChannel for WALK / IDLE / ATTACK transitions. AnimatedTexture extends Texture, so every Texture method is still available — add the wrapper's .obj to a scene like any other Texture.

Methods

  • AnimatedTexture (ChannelObj = null)

    Creates a new AnimatedTexture driven by the given default AnimationChannel.

    • @p ChannelObj is an AnimationChannel wrapper (or null for the adopt path).
  • adopt (object Ajo)

    Wraps an existing AnimatedTexture AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an AnimatedTexture.
    • @r A new wrapper.
  • getAnimationChannel ()

    Returns the currently-playing AnimationChannel AJO.

  • playAnimationChannel (object ChannelObj)

    Plays the given AnimationChannel from start to end once. The animation stops on the last frame.

    • @p ChannelObj is an AnimationChannel wrapper.
    • @r this object
  • playAnimationChannelFrom (object ChannelObj, int StartFrame)

    Plays the given AnimationChannel from StartFrame to end once.

    • @p ChannelObj is an AnimationChannel wrapper.
    • @p StartFrame is the frame index to begin playback from.
    • @r this object
  • loopNoOverride (object ChannelObj)

    Loops the given AnimationChannel indefinitely. If the channel is already the current channel, the loop is a no-op (use loopAnimationChannel to override).

    • @p ChannelObj is an AnimationChannel wrapper.
    • @r this object
  • loopAnimationChannel (object ChannelObj)

    Loops the given AnimationChannel indefinitely, overriding any current playback.

    • @p ChannelObj is an AnimationChannel wrapper.
    • @r this object
  • play ()

    Plays the current channel from start to end once.

    • @r this object
  • playFrom (int StartFrame)

    Plays the current channel from StartFrame to end once.

    • @r this object
  • playReverse ()

    Plays the current channel from end to start once.

    • @r this object
  • loop ()

    Loops the current channel indefinitely.

    • @r this object
  • loopReverse ()

    Loops the current channel in reverse indefinitely.

    • @r this object
  • stop ()

    Stops the animation and resets to frame 0.

    • @r this object
  • setOnCycleFinished (callback Cb)

    Registers a callback that runs every time the animation finishes a cycle.

    • @p Cb is a callback with no arguments.
    • @r this object
  • setInterpolator (InterpolatorObj)

    Sets the easing curve used by the underlying animation.

    • @p InterpolatorObj is an AussomJavaObject around an Interpolator (see fxgl.Interpolators).
    • @r this object
  • onUpdate (double Tpf)

    Drives the animation forward by Tpf seconds (normally the scene drives this automatically).

    • @p Tpf is the elapsed time in seconds.
    • @r this object