java.lang.Object
technology.sola.engine.graphics.components.SpriteKeyFrame

@NullMarked public class SpriteKeyFrame extends Object
SpriteKeyFrame holds information about how long a particular sprite should be rendered as part of an animation.
  • Field Details

    • DURATION_FREEZE

      public static final long DURATION_FREEZE
      This duration value informs the SpriteAnimatorSystem to not tick the duration of the sprite, so it will continue to render on this frame.
      See Also:
  • Constructor Details

    • SpriteKeyFrame

      public SpriteKeyFrame(String spriteSheetId, String spriteId)
      Creates a new sprite key frame from desired SpriteSheet id and sprite id. Defaults the duration to DURATION_FREEZE.
      Parameters:
      spriteSheetId - the SpriteSheet asset id
      spriteId - the sprite id
    • SpriteKeyFrame

      public SpriteKeyFrame(String spriteSheetId, String spriteId, long duration)
      Creates a new sprite key frame from desired SpriteSheet id, sprite id, and duration.
      Parameters:
      spriteSheetId - the SpriteSheet asset id
      spriteId - the sprite id
      duration - the duration of rendering for this frame in the animation sequence
    • SpriteKeyFrame

      public SpriteKeyFrame(SolaImage spriteImage)
      Creates a new sprite key frame from desired SolaImage. Defaults the duration to DURATION_FREEZE.
      Parameters:
      spriteImage - the image of the sprite
    • SpriteKeyFrame

      public SpriteKeyFrame(SolaImage spriteImage, long duration)
      Creates a new sprite key frame from desired SolaImage and duration.
      Parameters:
      spriteImage - the image of the sprite
      duration - the duration of rendering for this frame in the animation sequence
  • Method Details

    • getSpriteSheetId

      public @Nullable String getSpriteSheetId()
      Returns:
      the SpriteSheet asset id
    • getSpriteId

      public @Nullable String getSpriteId()
      Returns:
      the sprite id in the SpriteSheet
    • getDuration

      public long getDuration()
      Returns:
      the duration of this frame in the animation