com.threerings.media.animation
Class Animation

java.lang.Object
  extended by com.threerings.media.AbstractMedia
      extended by com.threerings.media.animation.Animation
All Implemented Interfaces:
Shape
Direct Known Subclasses:
AnimationSequencer, BlankAnimation, BlendAnimation, BobbleAnimation, ChatGlyph, ExplodeAnimation, FadeAnimation, FloatingTextAnimation, GleamAnimation, MultiFrameAnimation, RainAnimation, ScaleAnimation, SparkAnimation, SpriteAnimation, SpritePathAnimation

public abstract class Animation
extends AbstractMedia

The animation class is an abstract class that should be extended to provide animation functionality. It is generally used in conjunction with an AnimationManager.


Nested Class Summary
protected static class Animation.AnimCompletedOp
          Used to dispatch AnimationObserver.animationCompleted(com.threerings.media.animation.Animation, long).
protected static class Animation.AnimStartedOp
          Used to dispatch AnimationObserver.animationStarted(com.threerings.media.animation.Animation, long).
 
Field Summary
protected  boolean _finished
          Whether the animation is finished.
 
Fields inherited from class com.threerings.media.AbstractMedia
_bounds, _firstTick, _mgr, _observers, _renderOrder, HUD_LAYER
 
Constructor Summary
Animation(Rectangle bounds)
          Constructs an animation.
 
Method Summary
 void addAnimationObserver(AnimationObserver obs)
          Adds an animation observer to this animation's list of observers.
protected  void didFinish(long tickStamp)
          Called when the animation is finished and the animation manager has removed it from service.
 boolean isFinished()
          Returns true if the animation has finished all of its business, false if not.
 void removeAnimationObserver(AnimationObserver obs)
          Removes an animation observer from this animation's list of observers.
 void reset()
          If this animation has run to completion, it can be reset to prepare it for another go.
 void setLocation(int x, int y)
          Set the location.
protected  void willFinish(long tickStamp)
          Called when the animation is finished and the animation manager is about to remove it from service.
protected  void willStart(long tickStamp)
          Prior to the first call to AbstractMedia.tick(long) on an abstract media, this method is called by the AbstractMediaManager.
 
Methods inherited from class com.threerings.media.AbstractMedia
addObserver, contains, contains, contains, contains, fastForward, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, paint, queueNotification, removeObserver, renderCompareTo, setRenderOrder, shutdown, tick, toString, toString, viewLocationDidChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_finished

protected boolean _finished
Whether the animation is finished.

Constructor Detail

Animation

public Animation(Rectangle bounds)
Constructs an animation.

Parameters:
bounds - the animation rendering bounds.
Method Detail

isFinished

public boolean isFinished()
Returns true if the animation has finished all of its business, false if not.


reset

public void reset()
If this animation has run to completion, it can be reset to prepare it for another go.


setLocation

public void setLocation(int x,
                        int y)
Description copied from class: AbstractMedia
Set the location.

Overrides:
setLocation in class AbstractMedia

willStart

protected void willStart(long tickStamp)
Description copied from class: AbstractMedia
Prior to the first call to AbstractMedia.tick(long) on an abstract media, this method is called by the AbstractMediaManager. It is called during the normal tick cycle, immediately prior to the first call to AbstractMedia.tick(long).

Note: It is imperative that super.willStart() is called by any entity that overrides this method because the AbstractMediaManager depends on the setting of the AbstractMedia._firstTick value to know whether or not to call this method.

Overrides:
willStart in class AbstractMedia

willFinish

protected void willFinish(long tickStamp)
Called when the animation is finished and the animation manager is about to remove it from service.


didFinish

protected void didFinish(long tickStamp)
Called when the animation is finished and the animation manager has removed it from service.


addAnimationObserver

public void addAnimationObserver(AnimationObserver obs)
Adds an animation observer to this animation's list of observers.


removeAnimationObserver

public void removeAnimationObserver(AnimationObserver obs)
Removes an animation observer from this animation's list of observers.