pulpcore.animation.event
Class TimelineEvent
java.lang.Object
pulpcore.animation.Animation
pulpcore.animation.event.TimelineEvent
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- AddSpriteEvent, RemoveSpriteEvent, SceneChangeEvent, SoundEvent
public abstract class TimelineEvent
- extends Animation
- implements Runnable
A TimelineEvent is an abstract class that can perform a certain action
after a specific delay. TimelineEvents are added to and executed by a
Timeline. Subclasses implement the run()
method.
An anonymous inner class can be used in a Scene2D to create a code block
that is executed after a delay:
int delay = 1000; // milliseconds
addEvent(new TimelineEvent(delay) {
public void run() {
// Code to execute after the delay
}
});
A TimelineEvent only executes once - if it is in a looping Timeline,
it only executes the first time.
| Methods inherited from class pulpcore.animation.Animation |
fastForward, getDuration, getEasing, getLoopDelay, getNumLoops, getStartDelay, getTime, getTotalDuration, isFinished, loop, loop, loopForever, loopForever, rewind, update |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TimelineEvent
public TimelineEvent(int delay)
updateState
protected void updateState(int animTime)
- Description copied from class:
Animation
- Updates the state based on the animation time, typically from 0 to
Animation.getDuration().
Note that the duration can be zero.
- Specified by:
updateState in class Animation
- Parameters:
animTime - The animation time, typically from 0 to Animation.getDuration(), although
an Easing can cause the value to be outside those bounds.
hasExecuted
public final boolean hasExecuted()
run
public abstract void run()
- Specified by:
run in interface Runnable
Copyright © 2007-2008 Interactive Pulp, LLC.