Constructor and Description |
---|
MotionAnimator(List<Motion> motions,
MotionListener listener,
boolean loop)
Creates a motion animator with the specified motion.
|
MotionAnimator(Motion motion,
MotionListener listener)
Creates a motion animator with the specified motion.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the animation.
|
void |
start(Timer timer,
long period)
Starts the animation on the given timer.
|
void |
stop()
Stops the animation.
|
public MotionAnimator(List<Motion> motions, MotionListener listener, boolean loop)
The given motion listener will be notified:
start(Timer, long)
,Motion.getCurrentValue()
,Motion.isFinished()
,stop()
.motions
- the list of motions to animate.listener
- the listener to notify for each step.loop
- if true, then the motion should loop until stopped.IndexOutOfBoundsException
- if there is no item in the motions list.public MotionAnimator(Motion motion, MotionListener listener)
The given motion listener will be notified:
start(Timer, long)
,Motion.getCurrentValue()
,Motion.isFinished()
,stop()
.motion
- the motion to animate.listener
- the listener to notify for each step.public void cancel()
Calls MotionListener.cancel()
on the registered listener.
public void start(Timer timer, long period)
Calls MotionListener.start(int)
on the registered listener with the start value of the motion.
If the motion animator is already started, it is firstly stopped.
timer
- the timer to schedule on.period
- time in milliseconds between motion steps.Timer.schedule(TimerTask, long, long)
,
Motion.getStartValue()
public void stop()
Calls MotionListener.stop(int)
on the registered listener with the stop value of the motion.
Motion.getStopValue()