Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Animation

[13:7] extends: FxObj

Wraps FXGL's Animation, the running animation handle returned by AnimationBuilder.build (or implicitly created by buildAndPlay). The wrapper exposes the play/pause/stop/resume controls plus a few progress accessors and the onFinished hook.

Methods

  • Animation (Ajo = null)

    Wraps an existing Animation AussomJavaObject. Normally produced by AnimationBuilder.build rather than constructed directly.

    • @p Ajo is an AussomJavaObject around an FXGL Animation.
  • start ()

    Starts the animation from the beginning.

    • @r this object
  • stop ()

    Stops the animation and resets to the start.

    • @r this object
  • pause ()

    Pauses the animation at the current frame.

    • @r this object
  • resume ()

    Resumes a paused animation.

    • @r this object
  • isAnimating ()

    Returns whether the animation is currently running.

    • @r A bool.
  • isPaused ()

    Returns whether the animation is currently paused.

    • @r A bool.
  • isAutoReverse ()

    Returns whether the animation auto-reverses on cycle completion.

    • @r A bool.
  • setOnFinished (callback Cb)

    Sets the callback fired when the animation finishes its full run (after any repeats).

    • @p Cb is a callback with no arguments.
    • @r this object
  • onUpdate (double Tpf)

    Drives the animation forward by tpf seconds. Normally called automatically by the FXGL scene; useful for manual control.

    • @p Tpf is a double with the elapsed time in seconds.
    • @r this object
  • startReverse ()

    Starts the animation playing in reverse from its end frame.

    • @r this object
  • setAutoReverse (bool Reverse)

    Sets whether the animation auto-reverses on alternating cycles.

    • @p Reverse is a bool.
    • @r this object
  • setReverse (bool Reverse)

    Sets the current playback direction. true plays in reverse, false plays forward.

    • @p Reverse is a bool.
    • @r this object
  • getReverse ()

    Returns the current playback direction.

    • @r A bool, true when playing in reverse.
  • setCycleCount (int Count)

    Sets the cycle (repeat) count at runtime.

    • @p Count is the new cycle count.
    • @r this object
  • getCycleCount ()

    Returns the configured cycle count.

    • @r An int.
  • setInterpolator (InterpolatorObj)

    Sets the interpolator (easing curve).

    • @p InterpolatorObj is an AussomJavaObject around a JavaFX Interpolator (see fxgl.Interpolators).
    • @r this object
  • getInterpolator ()

    Returns the current interpolator.

    • @r An AussomJavaObject around an Interpolator.
  • setTimeTo (double Seconds)

    Scrubs the animation to the given time in seconds. Useful for cutscene scrubbing or seeking.

    • @p Seconds is the target time in seconds.
    • @r this object
  • getEndTime ()

    Returns the total duration of one cycle in seconds.

    • @r A double.
  • getOnFinished ()

    Returns the onFinished callback currently registered, or null when none.

    • @r An AussomJavaObject around a Runnable.
  • setOnCycleFinished (callback Cb)

    Sets the per-cycle completion callback (fired at the end of each cycle, not only at the final cycle).

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

    Returns the per-cycle completion callback currently registered, or null when none.

    • @r An AussomJavaObject around a Runnable.
  • getAnimatedValue ()

    Returns the underlying AnimatedValue this Animation drives. Useful for inspecting the from / to values.

    • @r An AussomJavaObject around an AnimatedValue.