From 7efd53a76c673c438dd2a6fb3482698524fa6578 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Mon, 9 Jul 2007 22:49:48 +0000 Subject: [PATCH] Use _minAlpha to figure out when to stop moving alpha down, don't readd the sprite in tick since shutdown is taking care of it also git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@271 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../media/animation/GleamAnimation.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/java/com/threerings/media/animation/GleamAnimation.java b/src/java/com/threerings/media/animation/GleamAnimation.java index 62590ac0..2428f7b5 100644 --- a/src/java/com/threerings/media/animation/GleamAnimation.java +++ b/src/java/com/threerings/media/animation/GleamAnimation.java @@ -97,16 +97,15 @@ public class GleamAnimation extends Animation _lastUpdate = timestamp; int alpha; if (_upfunc != null) { - if ((alpha = _upfunc.getValue(timestamp)) == _maxAlpha) { + if ((alpha = _upfunc.getValue(timestamp)) >= _maxAlpha) { _upfunc = null; } } else if (_downfunc != null) { - if ((alpha = _downfunc.getValue(timestamp)) == 0) { + if ((alpha = _downfunc.getValue(timestamp)) <= _minAlpha) { _downfunc = null; } } else { _finished = true; - _spmgr.addSprite(_sprite); return; } @@ -202,17 +201,6 @@ public class GleamAnimation extends Animation } } - @Override //documentation inherited - public void reset () - { - super.reset(); - _upfunc = new LinearTimeFunction(0, _maxAlpha, _upmillis); - _downfunc = new LinearTimeFunction(_maxAlpha, 0, _downmillis); - if (_spmgr.isManaged(_sprite)) { - _spmgr.removeSprite(_sprite); - } - } - protected SpriteManager _spmgr; protected Sprite _sprite; protected Color _color; @@ -224,6 +212,7 @@ public class GleamAnimation extends Animation protected int _upmillis; protected int _downmillis; protected int _maxAlpha; + protected int _minAlpha; protected int _alpha = -1; protected long _lastUpdate; protected int _millisBetweenUpdates;