Let our caller know if our fade level actually changed.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3427 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -54,9 +54,10 @@ public abstract class FadeAnimation extends Animation
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void tick (long timestamp)
|
public void tick (long timestamp)
|
||||||
{
|
{
|
||||||
_effect.tick(timestamp);
|
if (_effect.tick(timestamp)) {
|
||||||
_finished = _effect.finished();
|
_finished = _effect.finished();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
|
|||||||
@@ -52,18 +52,24 @@ public class FadeEffect
|
|||||||
(_alpha >= _target) : (_alpha <= _target);
|
(_alpha >= _target) : (_alpha <= _target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick (long tickStamp)
|
public boolean tick (long tickStamp)
|
||||||
{
|
{
|
||||||
// figure out the current alpha
|
// figure out the current alpha
|
||||||
long msecs = tickStamp - _initStamp;
|
long msecs = tickStamp - _initStamp;
|
||||||
_alpha = _startAlpha + (msecs * _step);
|
float alpha = _startAlpha + (msecs * _step);
|
||||||
if (_alpha < 0.0f) {
|
if (alpha < 0.0f) {
|
||||||
_alpha = 0.0f;
|
alpha = 0.0f;
|
||||||
} else if (_alpha > 1.0f) {
|
} else if (alpha > 1.0f) {
|
||||||
_alpha = 1.0f;
|
alpha = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
_comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha);
|
if (_alpha != alpha) {
|
||||||
|
_alpha = alpha;
|
||||||
|
_comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforePaint (Graphics2D gfx)
|
public void beforePaint (Graphics2D gfx)
|
||||||
|
|||||||
Reference in New Issue
Block a user