com.threerings.media.effects
Class FadeEffect

java.lang.Object
  extended by com.threerings.media.effects.FadeEffect

public class FadeEffect
extends Object

Handles the math and timing of doing a fade effect in a sprite or animation.


Field Summary
protected  float _alpha
          The current alpha of the image.
protected  Composite _comp
          The composite used to render the image with the current alpha.
protected  boolean _finished
          True when we're finished.
protected  long _initStamp
          Time zero.
protected  Composite _ocomp
          The composite in effect outside our faded render.
protected  float _startAlpha
          The starting alpha.
protected  float _step
          The alpha step per millisecond.
protected  float _target
          The target alpha.
 
Constructor Summary
FadeEffect(float alpha, float step, float target)
           
 
Method Summary
 void afterPaint(Graphics2D gfx)
           
 void beforePaint(Graphics2D gfx)
           
 boolean finished()
           
 float getAlpha()
           
 void init(long tickStamp)
           
 boolean tick(long tickStamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_comp

protected Composite _comp
The composite used to render the image with the current alpha.


_ocomp

protected Composite _ocomp
The composite in effect outside our faded render.


_alpha

protected float _alpha
The current alpha of the image.


_target

protected float _target
The target alpha.


_step

protected float _step
The alpha step per millisecond.


_startAlpha

protected float _startAlpha
The starting alpha.


_initStamp

protected long _initStamp
Time zero.


_finished

protected boolean _finished
True when we're finished.

Constructor Detail

FadeEffect

public FadeEffect(float alpha,
                  float step,
                  float target)
Method Detail

init

public void init(long tickStamp)

finished

public boolean finished()

getAlpha

public float getAlpha()

tick

public boolean tick(long tickStamp)

beforePaint

public void beforePaint(Graphics2D gfx)

afterPaint

public void afterPaint(Graphics2D gfx)