Interface AnimationFacade


public interface AnimationFacade
High-level sprite clip animation controls for one entity.

Operations affect an existing animated-sprite capability only. They do not create animation or render components on an arbitrary entity.

  • Method Details

    • exists

      boolean exists()
      Returns whether the entity has a complete animated-sprite capability.
    • clip

      String clip()
      Returns the selected clip name, or an empty string when animation is absent.
    • hasClip

      boolean hasClip(String clipName)
      Returns whether the animation defines the supplied non-blank clip name.
    • frame

      int frame()
      Returns the resolved animation/atlas frame index held by Runtime, or -1 when no frame has been resolved.
    • stateTime

      float stateTime()
      Returns the existing animation playback time, or 0 when absent.
    • play

    • pause

    • stop

    • restart

      AnimationFacade restart()
    • setAnimation

      AnimationFacade setAnimation(int assetId)
      Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.
      Throws:
      IllegalArgumentException - when the animation is unknown, unavailable, or not owned by this entity; the previous animation state remains unchanged
    • setAnimation

      AnimationFacade setAnimation(String animationName)
      Atomically selects an animation owned by this entity, restoring the definition's authored default clip and fps while preserving playback and loop state.
      Throws:
      IllegalArgumentException - when the animation is unknown, unavailable, or not owned by this entity; the previous animation state remains unchanged
    • play

      AnimationFacade play(String clipName)
      Selects and starts an existing clip.
      Throws:
      IllegalArgumentException - when the clip name is blank or unknown; the previous animation state remains unchanged
    • play

      AnimationFacade play(int animationAssetId, String clipName)
      Atomically selects an owned animation and starts one of its clips.
      Throws:
      IllegalArgumentException - when the animation or clip is unknown, the animation is unavailable, or the animation is not owned by this entity; previous state remains unchanged
    • play

      AnimationFacade play(String animationName, String clipName)
      Atomically selects an owned animation and starts one of its clips.
      Throws:
      IllegalArgumentException - when the animation or clip is unknown, the animation is unavailable, or the animation is not owned by this entity; previous state remains unchanged
    • setClip

      AnimationFacade setClip(String clipName)
      Selects an existing clip and resets its frame and playback time.
      Throws:
      IllegalArgumentException - when the clip name is blank or unknown; the previous animation state remains unchanged
    • setLoop

      AnimationFacade setLoop(boolean loop)
    • setFps

      AnimationFacade setFps(float fps)
      Sets playback frames per second. Zero is allowed as a non-advancing rate.
      Throws:
      IllegalArgumentException - when fps is negative, NaN, or infinite
    • setStateTime

      AnimationFacade setStateTime(float stateTime)
      Sets playback time, clamping negative finite values to zero.
      Throws:
      IllegalArgumentException - when the value is NaN or infinite
    • isPlaying

      boolean isPlaying()
    • isLooping

      boolean isLooping()
    • fps

      float fps()
    • isFinished

      boolean isFinished()
      Returns whether the selected non-looping clip has consumed its complete playback duration. Looping clips and missing or invalid animation state never report finished.