public class Animator extends AnimatorBase
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(boolean) 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.
AnimatorBase.AnimatorImplDEFAULT_FRAMES_PER_INTERVAL| Constructor and Description |
|---|
Animator() |
Animator(GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.
|
Animator(ThreadGroup tg) |
Animator(ThreadGroup tg,
GLAutoDrawable drawable)
Creates a new Animator for a particular drawable.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAnimating()
Indicates whether this animator is running and animating,
the latter is true if it has GLAutoDrawables to render and is not paused. |
boolean |
isPaused()
Indicates whether this animator is running and paused.
|
boolean |
isStarted()
Indicates whether this animator is running, ie.
|
boolean |
pause()
Pauses this animator.
|
boolean |
resume()
Resumes animation if paused.
|
void |
setRunAsFastAsPossible(boolean runFast)
Sets a flag in this Animator indicating that it is to run as
fast as possible.
|
boolean |
start()
Starts this animator, if not running.
|
boolean |
stop()
Stops this animator.
|
add, getFPSStartTime, getLastFPS, getLastFPSPeriod, getLastFPSUpdateTime, getThread, getTotalFPS, getTotalFPSDuration, getTotalFPSFrames, getUpdateFPSFrames, remove, resetFPSCounter, setIgnoreExceptions, setPrintExceptions, setUpdateFPSFrames, toStringpublic Animator()
public Animator(ThreadGroup tg)
public Animator(GLAutoDrawable drawable)
public Animator(ThreadGroup tg, GLAutoDrawable drawable)
public final void setRunAsFastAsPossible(boolean runFast)
public final boolean isStarted()
GLAnimatorControlpublic final boolean isAnimating()
GLAnimatorControlGLAutoDrawables to render and is not paused.public final boolean isPaused()
GLAnimatorControlpublic boolean start()
GLAnimatorControlIn 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 started, all counters (time, frames, ..) are reset to zero.
GLAnimatorControl.stop(),
GLAnimatorControl.isAnimating(),
GLAnimatorControl.getThread()public boolean stop()
GLAnimatorControlIn 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.
GLAnimatorControl.start(),
GLAnimatorControl.isAnimating(),
GLAnimatorControl.getThread()public boolean pause()
GLAnimatorControlIn 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.
GLAnimatorControl.resume(),
GLAnimatorControl.isAnimating()public boolean resume()
GLAnimatorControlIn 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.
GLAnimatorControl.pause(),
GLAnimatorControl.isAnimating()Copyright 2010 JogAmp Community.