public class AnimatorObject extends Object implements Animator
Animator
behavior.Constructor and Description |
---|
AnimatorObject()
Constructs an animated object with a default
animationPeriod() of 40
milliseconds (25Hz). |
AnimatorObject(TimingHandler handler)
Constructs an animated object with a default
animationPeriod() of 40
milliseconds (25Hz). |
Modifier and Type | Method and Description |
---|---|
void |
animate()
Main call back animated method.
|
long |
animationPeriod()
The animation loop period, in milliseconds.
|
boolean |
animationStarted()
Return
true when the animation loop is started. |
boolean |
invokeAnimationHandler()
Returns whether or not the animated method is defined externally, as when register it
through reflection.
|
void |
restartAnimation()
Restart the animation.
|
void |
setAnimationPeriod(long period)
Convenience function that simply calls
period(period, true) . |
void |
setAnimationPeriod(long period,
boolean restart)
Sets the
animationPeriod() , in milliseconds. |
void |
setTimingHandler(TimingHandler h)
Sets the timing handler.
|
void |
startAnimation()
Starts the animation loop.
|
void |
stopAnimation()
Stops animation.
|
SeqTimer |
timer()
Returns the sequential timer.
|
TimingHandler |
timingHandler()
Returns the timing handler.
|
void |
toggleAnimation()
|
public AnimatorObject()
animationPeriod()
of 40
milliseconds (25Hz). The handler should explicitly be defined afterwards (
setTimingHandler(TimingHandler)
).public AnimatorObject(TimingHandler handler)
animationPeriod()
of 40
milliseconds (25Hz).public void setTimingHandler(TimingHandler h)
Animator
setTimingHandler
in interface Animator
public TimingHandler timingHandler()
Animator
timingHandler
in interface Animator
public SeqTimer timer()
Animator
public boolean animationStarted()
true
when the animation loop is started.
The timing handler will check when animationStarted()
and then called the
animation callback method every animationPeriod()
milliseconds.
Use startAnimation()
, stopAnimation()
or toggleAnimation()
to change this value.
animationStarted
in interface Animator
startAnimation()
,
animate()
public long animationPeriod()
animationStarted()
, this is
the delay that takes place between two consecutive iterations of the animation loop.
This delay defines a target frame rate that will only be achieved if your
animate()
methods is fast enough.
Default value is 40 milliseconds (25 Hz).
Note: This value is taken into account only the next time you call
startAnimation()
. If animationStarted()
, you should
stopAnimation()
first. See restartAnimation()
and
setAnimationPeriod(long, boolean)
.
animationPeriod
in interface Animator
setAnimationPeriod(long, boolean)
public void setAnimationPeriod(long period)
period(period, true)
.setAnimationPeriod
in interface Animator
setAnimationPeriod(long, boolean)
public void setAnimationPeriod(long period, boolean restart)
animationPeriod()
, in milliseconds. If restart is true
and
animationStarted()
then restartAnimation()
is called.setAnimationPeriod
in interface Animator
startAnimation()
public void stopAnimation()
stopAnimation
in interface Animator
animationStarted()
public void startAnimation()
startAnimation
in interface Animator
animationStarted()
public void restartAnimation()
Simply calls stopAnimation()
and then startAnimation()
.
restartAnimation
in interface Animator
public void toggleAnimation()
toggleAnimation
in interface Animator
public void animate()
Animator
public boolean invokeAnimationHandler()
Animator
invokeAnimationHandler
in interface Animator
Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia