org.dishevelled.piccolo.sprite
Class MultipleFramesAnimation

java.lang.Object
  extended by org.dishevelled.piccolo.sprite.MultipleFramesAnimation
All Implemented Interfaces:
Animation

public final class MultipleFramesAnimation
extends Object
implements Animation

Multiple frames animation.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Constructor Summary
MultipleFramesAnimation(List<Image> frames)
          Create a new multiple frames animation with the specified list of frames.
 
Method Summary
 boolean advance()
          Advance this animation one frame.
 Image getCurrentFrame()
          Return the current frame for this animation.
 void reset()
          Reset this multiple frames animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleFramesAnimation

public MultipleFramesAnimation(List<Image> frames)
Create a new multiple frames animation with the specified list of frames.

The specified list of frames must contain at least one frame. The frames in frames are copied defensively into this class.

Parameters:
frames - list of frames, must not be null and must contain at least one frame
Throws:
IllegalArgumentException - if frames.size() < 1
Method Detail

reset

public void reset()
Reset this multiple frames animation.


advance

public boolean advance()
Advance this animation one frame.

Specified by:
advance in interface Animation
Returns:
true if consumers of this animation should schedule a repaint

getCurrentFrame

public Image getCurrentFrame()
Return the current frame for this animation. The current frame will not be null.

Specified by:
getCurrentFrame in interface Animation
Returns:
the current frame for this animation


Copyright (c) 2006-2011 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).