com.threerings.media.animation
Class GleamAnimation

java.lang.Object
  extended by com.threerings.media.AbstractMedia
      extended by com.threerings.media.animation.Animation
          extended by com.threerings.media.animation.GleamAnimation
All Implemented Interfaces:
Shape

public class GleamAnimation
extends Animation

Washes all non-transparent pixels in a sprite with a particular color (by compositing them with the solid color with progressively higher alpha values) and then back again.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.media.animation.Animation
Animation.AnimCompletedOp, Animation.AnimStartedOp
 
Field Summary
protected  int _alpha
           
protected  Color _color
           
protected  TimeFunction _downfunc
           
protected  int _downmillis
           
protected  boolean _fadeIn
           
protected  long _lastUpdate
           
protected  int _maxAlpha
           
protected  int _millisBetweenUpdates
           
protected  int _minAlpha
           
protected  Image _offimg
           
protected  SpriteManager _spmgr
           
protected  Sprite _sprite
           
protected  TimeFunction _upfunc
           
protected  int _upmillis
           
 
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
GleamAnimation(Sprite sprite, Color color, int upmillis, int downmillis, boolean fadeIn)
          Creates a gleam animation with the supplied sprite.
GleamAnimation(SpriteManager spmgr, Sprite sprite, Color color, int upmillis, int downmillis, boolean fadeIn)
          Creates a gleam animation with the supplied sprite.
 
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  void shutdown()
          Called by the media manager after the media is removed from service.
 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, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, queueNotification, removeObserver, renderCompareTo, setRenderOrder, toString, toString, viewLocationDidChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_spmgr

protected SpriteManager _spmgr

_sprite

protected Sprite _sprite

_color

protected Color _color

_offimg

protected Image _offimg

_fadeIn

protected boolean _fadeIn

_upfunc

protected TimeFunction _upfunc

_downfunc

protected TimeFunction _downfunc

_upmillis

protected int _upmillis

_downmillis

protected int _downmillis

_maxAlpha

protected int _maxAlpha

_minAlpha

protected int _minAlpha

_alpha

protected int _alpha

_lastUpdate

protected long _lastUpdate

_millisBetweenUpdates

protected int _millisBetweenUpdates
Constructor Detail

GleamAnimation

public GleamAnimation(Sprite sprite,
                      Color color,
                      int upmillis,
                      int downmillis,
                      boolean fadeIn)
Creates a gleam animation with the supplied sprite. The sprite will be faded to the specified color and then back again.

Parameters:
fadeIn - if true, the sprite itself will be faded in as we fade up to the gleam color and the gleam color will fade out, leaving just the sprite imagery.

GleamAnimation

public GleamAnimation(SpriteManager spmgr,
                      Sprite sprite,
                      Color color,
                      int upmillis,
                      int downmillis,
                      boolean fadeIn)
Creates a gleam animation with the supplied sprite. The sprite will be faded to the specified color and then back again. The sprite may be already added to the supplied sprite manager or not, but when the animation is complete, it will have been added.

Parameters:
fadeIn - if true, the sprite itself will be faded in as we fade up to the gleam color and the gleam color will fade out, leaving just the sprite imagery.
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.

fastForward

public void fastForward(long timeDelta)
Description copied from class: AbstractMedia
Called when the appropriate media manager has been paused for some length of time and is then unpaused. Media should adjust any time stamps that are maintained internally forward by the delta so that time maintains the illusion of flowing smoothly forward.

Overrides:
fastForward in class AbstractMedia

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

shutdown

protected void shutdown()
Description copied from class: AbstractMedia
Called by the media manager after the media is removed from service. Derived classes may override this method, but should be sure to call super.shutdown().

Overrides:
shutdown in class AbstractMedia