|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.AbstractMedia
com.threerings.media.animation.Animation
com.threerings.media.animation.SparkAnimation
public class SparkAnimation
Displays a set of spark images originating from a specified position and flying outward in random directions, fading out as they go, for a specified period of time.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.media.animation.Animation |
|---|
Animation.AnimCompletedOp, Animation.AnimStartedOp |
| Field Summary | |
|---|---|
protected float |
_alpha
The percent alpha with which to render the images. |
protected AlphaComposite |
_comp
The alpha composite with which to render the images. |
protected long |
_delay
The duration of the spark animation in milliseconds. |
protected boolean |
_fade
Whether or not we should fade the sparks out. |
protected int |
_icount
The number of images we're animating. |
protected Mirage[] |
_images
The spark images we're animating. |
protected int[] |
_ox
The starting 'jog' positions for each spark. |
protected int[] |
_oy
The starting 'jog' positions for each spark. |
protected long |
_start
The starting animation time. |
protected float[] |
_sxvel
The starting x-axis velocity of each chunk. |
protected float[] |
_syvel
The starting y-axis velocity of each chunk. |
protected float |
_xacc
The x axis acceleration in pixels per millisecond. |
protected int[] |
_xpos
The current positions of each spark. |
protected float |
_yacc
The y axis acceleration in pixels per millisecond. |
protected int[] |
_ypos
The current positions of each spark. |
| 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 | |
|---|---|
SparkAnimation(Rectangle bounds,
int x,
int y,
int xjog,
int yjog,
float minxvel,
float minyvel,
float maxxvel,
float maxyvel,
float xacc,
float yacc,
Mirage[] images,
long delay,
boolean fade)
Constructs a spark animation with the supplied parameters. |
|
| Method Summary | |
|---|---|
void |
fastForward(long timeDelta)
Called when the appropriate media manager has been paused for some length of time and is then unpaused. |
void |
paint(Graphics2D gfx)
Called by the appropriate manager to request that the media render itself with the given graphics context. |
protected int |
randomDirection()
Returns at random -1 for negative direction or +1 for positive. |
void |
tick(long timestamp)
Called periodically by this media's manager to give it a chance to do its thing. |
protected void |
toString(StringBuilder buf)
This should be overridden by derived classes (which should be sure to call super.toString()) to append the derived class
specific information to the string buffer. |
protected void |
willStart(long stamp)
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, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, queueNotification, removeObserver, renderCompareTo, setRenderOrder, shutdown, toString, viewLocationDidChange |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Mirage[] _images
protected int _icount
protected float _xacc
protected float _yacc
protected float[] _sxvel
protected float[] _syvel
protected int[] _ox
protected int[] _oy
protected int[] _xpos
protected int[] _ypos
protected long _start
protected boolean _fade
protected float _alpha
protected AlphaComposite _comp
protected long _delay
| Constructor Detail |
|---|
public SparkAnimation(Rectangle bounds,
int x,
int y,
int xjog,
int yjog,
float minxvel,
float minyvel,
float maxxvel,
float maxyvel,
float xacc,
float yacc,
Mirage[] images,
long delay,
boolean fade)
bounds - the bounding rectangle for the animation.x - the starting x-position for the sparks.y - the starting y-position for the sparks.xjog - the maximum X distance by which to "jog" the initial spark
positions, or 0 if no jogging is desired.yjog - the maximum Y distance by which to "jog" the initial spark
positions, or 0 if no jogging is desired.minxvel - the minimum starting x-velocity of the sparks.minyvel - the minimum starting y-velocity of the sparks.maxxvel - the maximum x-velocity of the sparks.maxyvel - the maximum y-velocity of the sparks.xacc - the x axis acceleration, or 0 if none is desired.yacc - the y axis acceleration, or 0 if none is desired.images - the spark images to be animated.delay - the duration of the animation in milliseconds.fade - do the fade thing| Method Detail |
|---|
protected int randomDirection()
protected void willStart(long stamp)
AbstractMediaAbstractMedia.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.
willStart in class Animationpublic void fastForward(long timeDelta)
AbstractMedia
fastForward in class AbstractMediapublic void tick(long timestamp)
AbstractMedia
tick in class AbstractMediatimestamp - 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.public void paint(Graphics2D gfx)
AbstractMedia
paint in class AbstractMediaprotected void toString(StringBuilder buf)
AbstractMediasuper.toString()) to append the derived class
specific information to the string buffer.
toString in class AbstractMedia
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||