fang2.transformers
Class ColorTransformer

java.lang.Object
  extended by fang2.transformers.InterpolatorTransformer
      extended by fang2.transformers.ColorTransformer
All Implemented Interfaces:
Transformer

public class ColorTransformer
extends InterpolatorTransformer


Constructor Summary
ColorTransformer(double transitionTime, boolean enabled, Color startColor, Color endColor)
          Make a ColorTransformer with the given cycle and colors.
ColorTransformer(double transitionTime, Color startColor, Color endColor)
          Make a ColorTransformer with the given cycle and colors.
 
Method Summary
 Color getEndColor()
           
 Color getStartColor()
           
protected  void interpolate(double fractionEndColor)
          Update the current color based on interpolated percentage.
 void setEndColor(Color endColor)
           
 void setStartColor(Color startColor)
           
 void updateSprite(Sprite sprite)
          Apply the color to the sprite.
 
Methods inherited from class fang2.transformers.InterpolatorTransformer
advance, getTransitionTime, isCycling, isEnabled, isOscillating, nonMaskableAdvance, setCycling, setEnabled, setOscillating, setTransitionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorTransformer

public ColorTransformer(double transitionTime,
                        boolean enabled,
                        Color startColor,
                        Color endColor)
Make a ColorTransformer with the given cycle and colors.

Parameters:
transitionTime - transition cycle time
enabled - does it start enabled?
startColor - starting color
endColor - ending color

ColorTransformer

public ColorTransformer(double transitionTime,
                        Color startColor,
                        Color endColor)
Make a ColorTransformer with the given cycle and colors.

Parameters:
transitionTime - transition cycle time
startColor - starting color
endColor - ending color
Method Detail

getEndColor

public Color getEndColor()
Returns:
the endColor

getStartColor

public Color getStartColor()
Returns:
the startColor

setEndColor

public void setEndColor(Color endColor)
Parameters:
endColor - the endColor to set

setStartColor

public void setStartColor(Color startColor)
Parameters:
startColor - the startColor to set

updateSprite

public void updateSprite(Sprite sprite)
Apply the color to the sprite.

Specified by:
updateSprite in interface Transformer
Specified by:
updateSprite in class InterpolatorTransformer
Parameters:
sprite - the sprite to update

interpolate

protected void interpolate(double fractionEndColor)
Update the current color based on interpolated percentage.

Specified by:
interpolate in class InterpolatorTransformer
Parameters:
fractionEndColor - the percentage of endColor to use (remainder comes from startColor)