Class Animation


  • public class Animation
    extends java.lang.Object
    Shows a number of images in sequence. Every frame in the animation is shown for a certain amount of time, indicated in seconds. After all images have been shown, the animation will either loop or keep showing the last image.

    Note that this class *describes* the animation, it does not contain any state that relates to *showing* the animation. This allows for using the same animation data to display the animation multiple times simultaneously, but it does mean the animation's playback state needs to be managed by the user of this class.

    • Constructor Detail

      • Animation

        public Animation​(boolean loop)
      • Animation

        public Animation​(java.util.List<Image> frames,
                         float frameTime,
                         boolean loop)
      • Animation

        public Animation​(Image frame)
    • Method Detail

      • addFrame

        public void addFrame​(Image frame,
                             float frameTime)
      • getFrameCount

        public int getFrameCount()
      • getFrameImages

        public java.util.List<Image> getFrameImages()
      • getFrameAtIndex

        public Image getFrameAtIndex​(int index)
      • getFrameAtTime

        public Image getFrameAtTime​(float time)
      • getDuration

        public float getDuration()
      • setFrameTime

        public void setFrameTime​(int index,
                                 float frameTime)
      • getFrameTime

        public float getFrameTime​(int index)
      • isLoop

        public boolean isLoop()