From 9b20077820050f8af5af17f16ae024f7df7ac5df Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Mon, 21 Apr 2008 19:03:47 +0000 Subject: [PATCH] Allow the min alpha to be specified in addition to the max git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@471 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../media/animation/GleamAnimation.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/media/animation/GleamAnimation.java b/src/java/com/threerings/media/animation/GleamAnimation.java index 20f54227..7ad477f0 100644 --- a/src/java/com/threerings/media/animation/GleamAnimation.java +++ b/src/java/com/threerings/media/animation/GleamAnimation.java @@ -82,6 +82,24 @@ public class GleamAnimation extends Animation */ 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; @@ -90,8 +108,8 @@ public class GleamAnimation extends Animation _upmillis = upmillis; _downmillis = downmillis; _maxAlpha = maxAlpha; - _upfunc = new LinearTimeFunction(0, _maxAlpha, upmillis); - _downfunc = new LinearTimeFunction(_maxAlpha, 0, downmillis); + _upfunc = new LinearTimeFunction(_minAlpha, _maxAlpha, upmillis); + _downfunc = new LinearTimeFunction(_maxAlpha, _minAlpha, downmillis); _fadeIn = fadeIn; _millisBetweenUpdates = millisBetweenUpdates; }