com.threerings.media.util
Interface FrameSequencer

All Known Subinterfaces:
AnimationFrameSequencer
All Known Implementing Classes:
AnimationFrameSequencer.MultiFunction, FrameSequencer.ConstantRate

public interface FrameSequencer

Used to control animation timing when displaying a MultiFrameImage. This interface allows for constant framerates, or more sophisticated animation timing.


Nested Class Summary
static class FrameSequencer.ConstantRate
          A frame sequencer that delivers a constant frame rate in either one shot or looping mode.
 
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.
 

Method Detail

init

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).

Parameters:
source - the multi-frame image that is providing the animation frames.
Returns:
initial frame index

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. If the sequencer returns -1, it is taken as an indication that the animation is finished and should be stopped.


fastForward

void fastForward(long timeDelta)
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.