public class Animation
extends java.lang.Object
Constructor and Description |
---|
Animation(java.lang.String imageLocation)
An animation with a single image; equivalent to a static image.
|
Animation(java.lang.String[] imageLocations,
long frameDuration)
Creates an animation from a list of images, specified in terms of their
file locations.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrame(java.awt.Image image,
long frameDuration)
Adds an image to the animation with the specified duration (time to
display the image).
|
java.awt.Image |
getImage()
Gets this Animation's current image.
|
java.lang.String[] |
getImageLocations() |
void |
initializeImages()
Initialize images relative to their locations.
|
void |
start()
Starts this animation over from the beginning.
|
void |
update()
Updates this animation's current image (frame), if necessary.
|
public Animation(java.lang.String[] imageLocations, long frameDuration)
imageLocations
- array of image locations.frameDuration
- time to display each frame.public Animation(java.lang.String imageLocation)
imageLocation
- file name of imagepublic void addFrame(java.awt.Image image, long frameDuration)
image
- frameDuration
- public void start()
public void update()
public java.awt.Image getImage()
public java.lang.String[] getImageLocations()
public void initializeImages()