com.threerings.media.animation
Class FadeAnimation

java.lang.Object
  extended by com.threerings.media.AbstractMedia
      extended by com.threerings.media.animation.Animation
          extended by com.threerings.media.animation.FadeAnimation
All Implemented Interfaces:
Shape
Direct Known Subclasses:
FadeImageAnimation, FadeLabelAnimation

public abstract class FadeAnimation
extends Animation

An animation that displays an image fading from one alpha level to another in specified increments over time. The animation is finished when the specified target alpha is reached.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.media.animation.Animation
Animation.AnimCompletedOp, Animation.AnimStartedOp
 
Field Summary
protected  FadeEffect _effect
          This handles the main work of fading.
 
Fields inherited from class com.threerings.media.animation.Animation
_finished
 
Fields inherited from class com.threerings.media.AbstractMedia
_bounds, _firstTick, _mgr, _observers, _renderOrder, HUD_LAYER
 
Constructor Summary
protected FadeAnimation(Rectangle bounds, float alpha, float step, float target)
          Constructs a fade animation.
 
Method Summary
 void paint(Graphics2D gfx)
          Called by the appropriate manager to request that the media render itself with the given graphics context.
protected abstract  void paintAnimation(Graphics2D gfx)
          Here is where derived animations actually render their image.
 void tick(long timestamp)
          Called periodically by this media's manager to give it a chance to do its thing.
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.animation.Animation
addAnimationObserver, didFinish, isFinished, removeAnimationObserver, reset, setLocation, willFinish
 
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, queueNotification, removeObserver, renderCompareTo, setRenderOrder, shutdown, toString, toString, viewLocationDidChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_effect

protected FadeEffect _effect
This handles the main work of fading.

Constructor Detail

FadeAnimation

protected FadeAnimation(Rectangle bounds,
                        float alpha,
                        float step,
                        float target)
Constructs a fade animation.

Parameters:
bounds - our bounds.
alpha - the starting alpha.
step - the alpha amount to step by each millisecond.
target - the target alpha level.
Method Detail

tick

public void tick(long timestamp)
Description copied from class: AbstractMedia
Called periodically by this media's manager to give it a chance to do its thing.

Specified by:
tick in class AbstractMedia
Parameters:
timestamp - a time stamp associated with this tick. Note: this is not obtained from a call to System.currentTimeMillis() and cannot be compared to timestamps obtained there from.

paint

public void paint(Graphics2D gfx)
Description copied from class: AbstractMedia
Called by the appropriate manager to request that the media render itself with the given graphics context. The media may wish to inspect the clipping region that has been set on the graphics context to render itself more efficiently. This method will only be called after it has been established that this media's bounds intersect the clipping region.

Specified by:
paint 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 Animation

paintAnimation

protected abstract void paintAnimation(Graphics2D gfx)
Here is where derived animations actually render their image.