Initialize the animation starting time when the animation is first ticked
rather than requiring that it be set via setStartTime(). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1764 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ExplodeAnimation.java,v 1.12 2002/08/19 21:08:51 shaper Exp $
|
// $Id: ExplodeAnimation.java,v 1.13 2002/10/01 04:24:34 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.media.animation;
|
package com.threerings.media.animation;
|
||||||
|
|
||||||
@@ -139,27 +139,26 @@ public class ExplodeAnimation extends Animation
|
|||||||
_angle = 0.0f;
|
_angle = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the animation starting time.
|
|
||||||
*/
|
|
||||||
public void setStartTime (long timestamp)
|
|
||||||
{
|
|
||||||
_start = timestamp;
|
|
||||||
if (_info.delay != -1) {
|
|
||||||
_end = _start + _info.delay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void fastForward (long timeDelta)
|
public void fastForward (long timeDelta)
|
||||||
{
|
{
|
||||||
_start += timeDelta;
|
if (_start > 0) {
|
||||||
_end += timeDelta;
|
_start += timeDelta;
|
||||||
|
_end += timeDelta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void tick (long timestamp)
|
public void tick (long timestamp)
|
||||||
{
|
{
|
||||||
|
if (_start == 0) {
|
||||||
|
// initialize our starting time
|
||||||
|
_start = timestamp;
|
||||||
|
if (_info.delay != -1) {
|
||||||
|
_end = _start + _info.delay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// figure out the distance the chunks have travelled
|
// figure out the distance the chunks have travelled
|
||||||
long msecs = timestamp - _start;
|
long msecs = timestamp - _start;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: FadeAnimation.java,v 1.4 2002/04/25 16:23:30 mdb Exp $
|
// $Id: FadeAnimation.java,v 1.5 2002/10/01 04:24:34 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.media.animation;
|
package com.threerings.media.animation;
|
||||||
|
|
||||||
@@ -46,17 +46,14 @@ public class FadeAnimation extends Animation
|
|||||||
_comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha);
|
_comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the animation starting time.
|
|
||||||
*/
|
|
||||||
public void setStartTime (long timestamp)
|
|
||||||
{
|
|
||||||
_start = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void tick (long timestamp)
|
public void tick (long timestamp)
|
||||||
{
|
{
|
||||||
|
if (_start == 0) {
|
||||||
|
// initialize our starting time
|
||||||
|
_start = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
// figure out the current alpha
|
// figure out the current alpha
|
||||||
long msecs = timestamp - _start;
|
long msecs = timestamp - _start;
|
||||||
_alpha = _startAlpha + (msecs * _step);
|
_alpha = _startAlpha + (msecs * _step);
|
||||||
@@ -79,7 +76,9 @@ public class FadeAnimation extends Animation
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void fastForward (long timeDelta)
|
public void fastForward (long timeDelta)
|
||||||
{
|
{
|
||||||
_start += timeDelta;
|
if (_start > 0) {
|
||||||
|
_start += timeDelta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
|
|||||||
Reference in New Issue
Block a user