Wait till willStart to create the gleaming functions so subclasses can fill in their desired alpha ranges and so on and the huge constructors aren't needed
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@476 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -49,10 +49,10 @@ public class GleamAnimation extends Animation
|
||||
* @param 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.
|
||||
*/
|
||||
public GleamAnimation (Sprite sprite, Color color, int upmillis,
|
||||
int downmillis, boolean fadeIn)
|
||||
public GleamAnimation (Sprite sprite, Color color, int upmillis, int downmillis,
|
||||
boolean fadeIn)
|
||||
{
|
||||
this(null, sprite, color, upmillis, downmillis, fadeIn, 750, 0);
|
||||
this(null, sprite, color, upmillis, downmillis, fadeIn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,41 +65,6 @@ public class GleamAnimation extends Animation
|
||||
*/
|
||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
||||
int downmillis, boolean fadeIn)
|
||||
{
|
||||
this(spmgr, sprite, color, upmillis, downmillis, fadeIn, 750, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param 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.
|
||||
* @param maxAlpha the maximum alpha value to scale the color to.
|
||||
* @param millisBetweenUpdates milliseconds to wait between actually updating the alpha and
|
||||
* redrawing
|
||||
*/
|
||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
||||
int downmillis, boolean fadeIn, int maxAlpha, int millisBetweenUpdates)
|
||||
{
|
||||
this(spmgr, sprite, color, upmillis, downmillis, fadeIn, 750, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param 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.
|
||||
* @param maxAlpha the maximum alpha value to scale the color to.
|
||||
* @param millisBetweenUpdates milliseconds to wait between actually updating the alpha and
|
||||
* redrawing
|
||||
* @param minAlpha the minimum alpha value to scale the color to.
|
||||
*/
|
||||
public GleamAnimation (SpriteManager spmgr, Sprite sprite, Color color, int upmillis,
|
||||
int downmillis, boolean fadeIn, int maxAlpha, int millisBetweenUpdates, int minAlpha)
|
||||
{
|
||||
super(new Rectangle(sprite.getBounds()));
|
||||
_spmgr = spmgr;
|
||||
@@ -107,13 +72,9 @@ public class GleamAnimation extends Animation
|
||||
_color = color;
|
||||
_upmillis = upmillis;
|
||||
_downmillis = downmillis;
|
||||
_maxAlpha = maxAlpha;
|
||||
_upfunc = new LinearTimeFunction(_minAlpha, _maxAlpha, upmillis);
|
||||
_downfunc = new LinearTimeFunction(_maxAlpha, _minAlpha, downmillis);
|
||||
_fadeIn = fadeIn;
|
||||
_millisBetweenUpdates = millisBetweenUpdates;
|
||||
}
|
||||
|
||||
|
||||
@Override // documentation inherited
|
||||
public void tick (long timestamp)
|
||||
{
|
||||
@@ -209,6 +170,9 @@ public class GleamAnimation extends Animation
|
||||
@Override // documentation inherited
|
||||
protected void willStart (long tickStamp)
|
||||
{
|
||||
_upfunc = new LinearTimeFunction(_minAlpha, _maxAlpha, _upmillis);
|
||||
_downfunc = new LinearTimeFunction(_maxAlpha, _minAlpha, _downmillis);
|
||||
|
||||
super.willStart(tickStamp);
|
||||
|
||||
// remove the sprite we're fiddling with from the manager; we'll
|
||||
@@ -237,7 +201,7 @@ public class GleamAnimation extends Animation
|
||||
protected TimeFunction _downfunc;
|
||||
protected int _upmillis;
|
||||
protected int _downmillis;
|
||||
protected int _maxAlpha;
|
||||
protected int _maxAlpha = 750;
|
||||
protected int _minAlpha;
|
||||
protected int _alpha = -1;
|
||||
protected long _lastUpdate;
|
||||
|
||||
Reference in New Issue
Block a user