Class Animation<T>

java.lang.Object
me.hsgamer.hscore.animate.Animation<T>
Type Parameters:
T - the frame type

public class Animation<T> extends Object
The animation that gets the frame based on the period
  • Constructor Details

    • Animation

      public Animation(List<T> frames, long periodMillis)
      Create a new animation
      Parameters:
      frames - the frames
      periodMillis - the period in milliseconds
  • Method Details

    • getFrames

      public List<T> getFrames()
      Get the frames
      Returns:
      the frames
    • getCurrentFrame

      public T getCurrentFrame(long currentMillis)
      Get the frame based on the current time
      Parameters:
      currentMillis - the current time in milliseconds
      Returns:
      the frame
    • getCurrentFrame

      public T getCurrentFrame()
      Get the frame based on the current time
      Returns:
      the frame
    • reset

      public void reset()
      Reset the animation
    • isFirstRun

      public boolean isFirstRun(long currentMillis)
      Check if it's the first run. It will return true if the animation is running for the first time.
      Parameters:
      currentMillis - the current time in milliseconds
      Returns:
      true if it's the first run
    • isFirstRun

      public boolean isFirstRun()
      Check if it's the first run. It will return true if the animation is running for the first time.
      Returns:
      true if it's the first run