framework
Class Animation
java.lang.Object
framework.Animation
- All Implemented Interfaces:
- Cloneable
public class Animation
- extends Object
- implements Cloneable
An Animation
is a set of images displayed one after another. Often used with the Sprite
class.
DEFAULT_FRAME_TIME
public static final int DEFAULT_FRAME_TIME
- See Also:
- Constant Field Values
Animation
public Animation(Image[] frames)
Animation
public Animation(Image[] frames,
boolean loop)
Animation
public Animation(Image[] frames,
int time)
Animation
public Animation(Image[] frames,
int time,
boolean loop)
Animation
public Animation(Image[] frames,
int[] times)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
Animation
public Animation(Image[] frames,
int[] times,
boolean loop)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getFrameTimes
public int[] getFrameTimes()
setFrameTime
public void setFrameTime(int time)
setFrameTimes
public void setFrameTimes(int[] times)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
isLooping
public boolean isLooping()
setLooping
public void setLooping(boolean loop)
setFrame
public void setFrame(int i)
getFrame
public int getFrame()
play
public void play()
pause
public void pause()
reset
public void reset(boolean start)
isRunning
public boolean isRunning()
update
public boolean update(int elapsedTime)
- Advance the animation by
elapsedTime
milliseconds.
- Parameters:
elapsedTime
- Number of milliseconds passed since last call to this method.
- Returns:
- True if the animation has changed, false otherwise.
nextFrame
public void nextFrame()
- Change to the next frame of the animation.
getImage
public Image getImage()
getFrames
public Image[] getFrames()
clone
public Object clone()
- Overrides:
clone
in class Object