public abstract class AbstractAnimation extends java.lang.Object implements Animation
Animation
interface. Defines the duration and freezed state
and provides a listener list.Modifier | Constructor and Description |
---|---|
protected |
AbstractAnimation(long duration)
Constructs an
Animation with the specified duration. |
protected |
AbstractAnimation(long duration,
boolean freezed)
Constructs an
Animation with the specified duration
and freezed mode. |
Modifier and Type | Method and Description |
---|---|
void |
addAnimationListener(AnimationListener listener)
Adds an
AnimationListener to this animation. |
void |
animate(long time)
Performs the animation at the given time: applies the animation
effect to the animation target, fires appropriate events,
and resets the effect if we exceeded the animations duration.
|
protected abstract void |
applyEffect(long time)
Applies the animation effect for the given time to the animation target.
|
long |
duration()
Returns this animation's duration.
|
protected void |
fireAnimationStarted(long time)
Fires an event that indicates that the animation has been started
at the specified time.
|
protected void |
fireAnimationStopped(long time)
Fires an event that indicates that the animation has been stopped
at the specified time.
|
boolean |
isFreezed()
Answers whether the animation effect should be freezed after
we exceeded the animation's duration.
|
void |
removeAnimationListener(AnimationListener listener)
Removes an
AnimationListener to this animation. |
java.lang.String |
toString()
Returns a string representation for this animation.
|
protected AbstractAnimation(long duration)
Animation
with the specified duration.duration
- the animation's durationprotected AbstractAnimation(long duration, boolean freezed)
Animation
with the specified duration
and freezed mode.duration
- the animation's durationfreezed
- true indicates that the effect will be retained after
the animation is finished, false resets the effect to the time 0public final long duration()
public final boolean isFreezed()
protected abstract void applyEffect(long time)
time
- the time used to determine the animation effectpublic void animate(long time)
public final void addAnimationListener(AnimationListener listener)
AnimationListener
to this animation.addAnimationListener
in interface Animation
listener
- the AnimationListener
to addpublic final void removeAnimationListener(AnimationListener listener)
AnimationListener
to this animation.removeAnimationListener
in interface Animation
listener
- the AnimationListener
to removeprotected final void fireAnimationStarted(long time)
time
- the time that will be reported in the eventprotected final void fireAnimationStopped(long time)
time
- the time that will be reported in the eventpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2011 JGoodies Karsten Lentzsch. All Rights Reserved.