org.dishevelled.piccolo.sprite
Class LoopedFramesAnimation

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

public final class LoopedFramesAnimation
extends Object
implements Animation

Looped frames animation.

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

Constructor Summary
LoopedFramesAnimation(List<Image> frames)
          Create a new looped 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopedFramesAnimation

public LoopedFramesAnimation(List<Image> frames)
Create a new looped 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

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).