com.threerings.media.animation
Class FadeAnimation
java.lang.Object
com.threerings.media.AbstractMedia
com.threerings.media.animation.Animation
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.
|
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.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 |
_effect
protected FadeEffect _effect
- This handles the main work of fading.
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.
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.