An Animator can be attached to one or more GLAutoDrawables to drive their display() methods in a loop.
The Animator class creates a background thread in which the
calls to display() are performed. After each drawable
has been redrawn, a brief pause is performed to avoid swamping the
CPU, unless setRunAsFastAsPossible has been called.
The Animator execution thread does not run as a daemon thread,
so it is able to keep an application from terminating.
Call stop() to terminate the animation and it's execution thread.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv volatile boolean | |
| private boolean | |
| private Runnable | |
| pack-priv volatile boolean | |
| private ThreadGroup | |
| private final AnimatorBase. | |
| private final AnimatorBase. | |
| private final AnimatorBase. | |
| private final AnimatorBase. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | Animator(final ThreadGroup tg, final GLAutoDrawable drawable)
Creates a new Animator w/ an associated ThreadGroup for a particular drawable. |
| Modifier and Type | Method and Description |
|---|---|
| protected final String | getBaseName(final String prefix)
Implements abstract com. |
| public final synchronized boolean | isAnimating()
Implements com. is started and is not paused.
|
| public final synchronized boolean | isPaused()
Implements com. is started
and either manually paused or paused
automatically due to no added GLAutoDrawables.
|
| public final synchronized boolean | |
| public final synchronized boolean | |
| public final synchronized void | setRunAsFastAsPossible(final boolean runFast)
Sets a flag in this Animator indicating that it is to run as fast as possible. |
| public final synchronized void | |
| public final synchronized boolean | |
| public final synchronized boolean |
| isAnimating | back to summary |
|---|---|
| pack-priv boolean isAnimating | |
| pauseIssued | back to summary |
|---|---|
| pack-priv volatile boolean pauseIssued | |
| runAsFastAsPossible | back to summary |
|---|---|
| private boolean runAsFastAsPossible | |
| runnable | back to summary |
|---|---|
| private Runnable runnable | |
| stopIssued | back to summary |
|---|---|
| pack-priv volatile boolean stopIssued | |
| threadGroup | back to summary |
|---|---|
| private ThreadGroup threadGroup | |
| waitForPausedCondition | back to summary |
|---|---|
| private final AnimatorBase. | |
| waitForResumeCondition | back to summary |
|---|---|
| private final AnimatorBase. | |
| waitForStartedCondition | back to summary |
|---|---|
| private final AnimatorBase. | |
| waitForStoppedCondition | back to summary |
|---|---|
| private final AnimatorBase. | |
| Animator | back to summary |
|---|---|
| public Animator() Creates a new, empty Animator. | |
| Animator | back to summary |
|---|---|
| public Animator(final ThreadGroup tg) Creates a new Animator w/ an associated ThreadGroup. | |
| Animator | back to summary |
|---|---|
| public Animator(final GLAutoDrawable drawable) Creates a new Animator for a particular drawable. | |
| Animator | back to summary |
|---|---|
| public Animator(final ThreadGroup tg, final GLAutoDrawable drawable) Creates a new Animator w/ an associated ThreadGroup for a particular drawable. | |
| getBaseName | back to summary |
|---|---|
| protected final String getBaseName(final String prefix) Implements abstract com.
| |
| isAnimating | back to summary |
|---|---|
| public final synchronized boolean isAnimating() Implements com. Doc from com. Indicates whether this animator
| |
| isPaused | back to summary |
|---|---|
| public final synchronized boolean isPaused() Implements com. Doc from com. Indicates whether this animator
| |
| pause | back to summary |
|---|---|
| public final synchronized boolean pause() Implements com. Doc from com. Pauses this animator. In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
| |
| resume | back to summary |
|---|---|
| public final synchronized boolean resume() Implements com. Doc from com. Resumes animation if paused. In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread. If resumed, all counters (time, frames, ..) are reset to zero.
| |
| setRunAsFastAsPossible | back to summary |
|---|---|
| public final synchronized void setRunAsFastAsPossible(final boolean runFast) Sets a flag in this Animator indicating that it is to run as fast as possible. By default there is a brief pause in the animation loop which prevents the CPU from getting swamped. This method may not have an effect on subclasses. | |
| setThreadGroup | back to summary |
|---|---|
| public final synchronized void setThreadGroup(final ThreadGroup tg) throws GLException Set a
| |
| start | back to summary |
|---|---|
| public final synchronized boolean start() Implements com. Doc from com. Starts this animator, if not running. In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
Note that an animator w/o If started, all counters (time, frames, ..) are reset to zero.
| |
| stop | back to summary |
|---|---|
| public final synchronized boolean stop() Implements com. Doc from com. Stops this animator. In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String |
| MainLoop | back to summary |
|---|---|
| pack-priv MainLoop() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |