framework
Class Animation

java.lang.Object
  extended by 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.


Field Summary
static int DEFAULT_FRAME_TIME
           
 
Constructor Summary
Animation(Image[] frames)
           
Animation(Image[] frames, boolean loop)
           
Animation(Image[] frames, int time)
           
Animation(Image[] frames, int[] times)
           
Animation(Image[] frames, int[] times, boolean loop)
           
Animation(Image[] frames, int time, boolean loop)
           
 
Method Summary
 Object clone()
           
 int getFrame()
           
 Image[] getFrames()
           
 int[] getFrameTimes()
           
 Image getImage()
           
 boolean isLooping()
           
 boolean isRunning()
           
 void nextFrame()
          Change to the next frame of the animation.
 void pause()
           
 void play()
           
 void reset(boolean start)
           
 void setFrame(int i)
           
 void setFrameTime(int time)
           
 void setFrameTimes(int[] times)
           
 void setLooping(boolean loop)
           
 boolean update(int elapsedTime)
          Advance the animation by elapsedTime milliseconds.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FRAME_TIME

public static final int DEFAULT_FRAME_TIME
See Also:
Constant Field Values
Constructor Detail

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
Method Detail

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