com.threerings.media.util
Class FrameSequencer.ConstantRate
java.lang.Object
com.threerings.media.util.FrameSequencer.ConstantRate
- All Implemented Interfaces:
- FrameSequencer
- Enclosing interface:
- FrameSequencer
public static class FrameSequencer.ConstantRate
- extends Object
- implements FrameSequencer
A frame sequencer that delivers a constant frame rate in either one shot or looping mode.
|
Constructor Summary |
FrameSequencer.ConstantRate(double framesPerSecond,
boolean loop)
Creates a constant rate frame sequencer with the desired target frames per second. |
|
Method Summary |
void |
fastForward(long timeDelta)
Called if the display is paused for some length of time and then unpaused. |
int |
init(MultiFrameImage source)
Called prior to the execution of an animation sequence (not necessarily immediately, so
time stamps should be obtained in the first call to tick). |
int |
tick(long tickStamp)
Called every display frame, the frame sequencer should return the index of the animation
frame that should be displayed during this tick. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_millisPerFrame
protected long _millisPerFrame
_loop
protected boolean _loop
_frameCount
protected int _frameCount
_startStamp
protected long _startStamp
FrameSequencer.ConstantRate
public FrameSequencer.ConstantRate(double framesPerSecond,
boolean loop)
- Creates a constant rate frame sequencer with the desired target frames per second.
- Parameters:
framesPerSecond - the target frames per second.loop - if false, the sequencer will report the end of the animation after
progressing through all of the frames once, otherwise it will loop indefinitely.
init
public int init(MultiFrameImage source)
- Description copied from interface:
FrameSequencer
- Called prior to the execution of an animation sequence (not necessarily immediately, so
time stamps should be obtained in the first call to tick).
- Specified by:
init in interface FrameSequencer
- Parameters:
source - the multi-frame image that is providing the animation frames.
- Returns:
- initial frame index
tick
public int tick(long tickStamp)
- Description copied from interface:
FrameSequencer
- Called every display frame, the frame sequencer should return the index of the animation
frame that should be displayed during this tick. If the sequencer returns -1, it is taken
as an indication that the animation is finished and should be stopped.
- Specified by:
tick in interface FrameSequencer
fastForward
public void fastForward(long timeDelta)
- Description copied from interface:
FrameSequencer
- Called if the display is paused for some length of time and then unpaused. Sequencers
should adjust any time stamps they are maintaining internally by the delta so that time
maintains the illusion of flowing smoothly forward.
- Specified by:
fastForward in interface FrameSequencer