public class Animator extends Object
The animator loops on:
Util.platformTimeMillis()
,Animation.tick(long)
of all the registered animations,Only one animator can be running at any time.
In the same way, Display.callOnFlushCompleted(Runnable)
must not be called when an animator is running
Modifier and Type | Class and Description |
---|---|
static interface |
Animator.AnimatorListener
Listener for animator events.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG_ANIMATOR_ENABLED_CONSTANT
BON boolean constant to enable/disable the animator debug. |
static String |
DEBUG_ANIMATOR_MONITOR_CONSTANT
BON Class constant to set the animator monitor. |
Constructor and Description |
---|
Animator()
Creates an animator.
|
Modifier and Type | Method and Description |
---|---|
void |
indicateRenderRequested()
Indicates to this animator that a render has been requested.
|
void |
startAnimation(Animation animation)
Starts an animation.
|
void |
stopAllAnimations()
Stops all the animations.
|
void |
stopAnimation(Animation animation)
Stops an animation.
|
public static final String DEBUG_ANIMATOR_ENABLED_CONSTANT
BON boolean constant
to enable/disable the animator debug.
If enabled, "ej.mwt.debug.animator.monitor" must also be set.
public static final String DEBUG_ANIMATOR_MONITOR_CONSTANT
BON Class constant
to set the animator monitor.
Set it to the FQN of an implementation of Animator.AnimatorListener
to monitor the animator.
public Animator()
Multiple animators may be created but only one can be running at any time.
public void indicateRenderRequested()
Calling this method is only useful if the DEBUG_ANIMATOR_ENABLED_CONSTANT
constant is enabled.
This method is called automatically when a render of a widget or of a desktop is requested. This method can be called manually if the animator is used to render something else.
public void startAnimation(Animation animation)
The animation tick method is then called every period.
If the animation is already started, nothing is done.
animation
- the animation to start.Animation.tick(long)
public void stopAllAnimations()
The tick method of every animation will not be called anymore by this animator.
This method must be called in the MicroUI thread.
IllegalStateException
- if this method is called in an other thread than the MicroUI thread or during an animation tick.public void stopAnimation(Animation animation)
The tick method of the given animation will not be called anymore by this animator.
This method must be called in the MicroUI thread.
animation
- the animation to stop.IllegalStateException
- if this method is called in an other thread than the MicroUI thread or during an animation tick.