|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.video.Animation
public class Animation
Allows multiple Visibles to be used based on time in an animation sequence.
The animation has a duration and a series of frames, each of which is another
Visible. The duration is used to determine how often the animation should
repeat.
Once start() is called, animation begins. When the draw() method is
called, the current frame is determined. This is done by first calculating
the time in milliseconds that has passed since start() was last called. This
is then divided by the duration. The remainder of that division is the
current time within the animation. This determines the current frame, since
each frame has a time value associated with it (the time value for a frame
that is less than or equal to the current time within the animation is used).
If there is no frame that fits the above, then nothing will be displayed.
API Stability: Stable.
Constructor Summary | |
---|---|
Animation()
Constructs an Animation object with a default duration of 1 millisecond. |
Method Summary | |
---|---|
void |
addFrame(long time,
Visible drawable)
Adds a frame to the animation that will be used after the given time value. |
void |
deinit(Context opt)
Deinitializes this Animation's frames. |
void |
draw(Context opt)
Draws the current frame of the Animation; implies a call to start(). |
void |
drawPass(Context opt,
Pass pass)
|
long |
firstFrame()
Utility method to return the first frame's time value. |
void |
init(Context opt)
Initializes this Animation's frames. |
void |
setDuration(long duration)
Sets the duration (in milliseconds) of the animation. |
void |
start()
Starts the animation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Animation()
Method Detail |
---|
public void setDuration(long duration)
duration
- a long value for the duration.
java.lang.IllegalArgumentException
- if the duration is less than or equal
to zero.public void addFrame(long time, Visible drawable)
time
- the time in milliseconds after which the frame will be used.drawable
- the Visible will be used as the frame.
java.lang.NullPointerException
- if drawable is null.public long firstFrame()
public void start()
java.lang.NullPointerException
- if init hasn't been called.public void init(Context opt)
init
in interface Visible
opt
- describes the rendering options that are being used.public void deinit(Context opt)
deinit
in interface Visible
opt
- describes the rendering options that are being used.public void draw(Context opt)
draw
in interface Visible
opt
- describes the rendering options that are being used.public void drawPass(Context opt, Pass pass)
drawPass
in interface MultipassVisible
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |