com.brackeen.javagamebook.graphics
Class Animation

java.lang.Object
  extended bycom.brackeen.javagamebook.graphics.Animation

public class Animation
extends java.lang.Object

The Animation class manages a series of images (frames) and the amount of time to display each frame.


Constructor Summary
Animation()
          Creates a new, empty Animation.
 
Method Summary
 void addFrame(java.awt.Image image, long duration)
          Adds an image to the animation with the specified duration (time to display the image).
 java.lang.Object clone()
          Creates a duplicate of this animation.
 java.awt.Image getImage()
          Gets this Animation's current image.
 void start()
          Starts this animation over from the beginning.
 void update(long elapsedTime)
          Updates this animation's current image (frame), if neccesary.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Animation

public Animation()
Creates a new, empty Animation.

Method Detail

clone

public java.lang.Object clone()
Creates a duplicate of this animation. The list of frames are shared between the two Animations, but each Animation can be animated independently.


addFrame

public void addFrame(java.awt.Image image,
                     long duration)
Adds an image to the animation with the specified duration (time to display the image).


start

public void start()
Starts this animation over from the beginning.


update

public void update(long elapsedTime)
Updates this animation's current image (frame), if neccesary.


getImage

public java.awt.Image getImage()
Gets this Animation's current image. Returns null if this animation has no images.