public abstract class AnimationEngine
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AnimationEngine.AnimationInfo
Class to hold target information of an animation.
|
protected class |
AnimationEngine.Listener
Listener class for changes to base values on a target element.
|
protected static class |
AnimationEngine.Sandwich
Class to hold an animation sandwich for a particular attribute.
|
protected static class |
AnimationEngine.TargetInfo
Class to hold XML and CSS animations for a target element.
|
Modifier and Type | Field and Description |
---|---|
static short |
ANIM_TYPE_CSS |
static short |
ANIM_TYPE_OTHER |
static short |
ANIM_TYPE_XML |
protected java.util.HashMap |
animations
Map of AbstractAnimations to AnimationInfo objects.
|
protected Document |
document
The document this AnimationEngine is managing animation for.
|
protected static java.util.Map.Entry[] |
MAP_ENTRY_ARRAY |
protected long |
pauseTime
The time at which the document was paused, or 0 if the document is not
paused.
|
protected AnimationEngine.Listener |
targetListener
The listener object for animation target base value changes.
|
protected java.util.HashMap |
targets
Map of AnimationTargets to TargetInfo objects.
|
protected TimedDocumentRoot |
timedDocumentRoot
The root time container for the document.
|
Constructor and Description |
---|
AnimationEngine(Document doc)
Creates a new AnimationEngine for the given document.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnimation(AnimationTarget target,
short type,
java.lang.String ns,
java.lang.String an,
AbstractAnimation anim)
Adds an animation to the document.
|
void |
addTimegraphListener(TimegraphListener l)
Adds a
TimegraphListener to the document. |
protected abstract TimedDocumentRoot |
createDocumentRoot()
Creates a new returns a new TimedDocumentRoot object for the document.
|
void |
dispose()
Disposes this animation engine.
|
protected AnimationEngine.AnimationInfo |
getAnimationInfo(AbstractAnimation anim)
Returns the AnimationInfo for the given AbstractAnimation.
|
float |
getCurrentTime()
Returns the current document time.
|
protected AnimationEngine.Sandwich |
getSandwich(AnimationTarget target,
short type,
java.lang.String ns,
java.lang.String an)
Returns the Sandwich for the given animation type/attribute.
|
protected AnimationEngine.TargetInfo |
getTargetInfo(AnimationTarget target)
Returns the TargetInfo for the given AnimationTarget.
|
boolean |
isPaused()
Returns whether animations are currently paused.
|
protected void |
moveToBottom(AbstractAnimation anim)
Moves the given animation to the bottom of the sandwich.
|
protected void |
moveToTop(AbstractAnimation anim)
Moves the given animation to the top of the sandwich.
|
void |
pause()
Pauses the animations.
|
protected void |
pushDown(AbstractAnimation anim)
Moves the animation down the sandwich such that it is in the right
position according to begin time and document order.
|
void |
removeAnimation(AbstractAnimation anim)
Removes an animation from the document.
|
void |
removeFill(AbstractAnimation anim)
Invoked to indicate that this timed element has had its fill removed.
|
void |
removeTimegraphListener(TimegraphListener l)
Removes a
TimegraphListener from the document. |
void |
sampledAt(AbstractAnimation anim,
float simpleTime,
float simpleDur,
int repeatIteration)
Invoked to indicate that this timed element has been sampled at the given
time.
|
void |
sampledLastValue(AbstractAnimation anim,
int repeatIteration)
Invoked to indicate that this timed element has been sampled at the end
of its active time, at an integer multiple of the simple duration.
|
float |
setCurrentTime(float t)
Sets the current document time.
|
protected float |
tick(float time,
boolean hyperlinking)
Updates the animations in the document to the given document time.
|
void |
toActive(AbstractAnimation anim,
float begin)
Invoked to indicate an animation became active at the specified time.
|
void |
toInactive(AbstractAnimation anim,
boolean isFrozen)
Invoked to indicate that this timed element became inactive.
|
void |
unpause()
Unpauses the animations.
|
public static final short ANIM_TYPE_XML
public static final short ANIM_TYPE_CSS
public static final short ANIM_TYPE_OTHER
protected Document document
protected TimedDocumentRoot timedDocumentRoot
protected long pauseTime
protected java.util.HashMap targets
protected java.util.HashMap animations
protected AnimationEngine.Listener targetListener
protected static final java.util.Map.Entry[] MAP_ENTRY_ARRAY
public AnimationEngine(Document doc)
public void dispose()
public void pause()
public void unpause()
public boolean isPaused()
public float getCurrentTime()
public float setCurrentTime(float t)
public void addAnimation(AnimationTarget target, short type, java.lang.String ns, java.lang.String an, AbstractAnimation anim)
target
- the target element of the animationtype
- the type of animation (must be one of the
ANIM_TYPE_*
constants defined in this classns
- the namespace URI of the attribute being animated, if
type ==
ANIM_TYPE_XML
an
- the attribute name if type ==
ANIM_TYPE_XML
, the property name if type ==
ANIM_TYPE_CSS
, and the animation type otherwiseanim
- the animationpublic void removeAnimation(AbstractAnimation anim)
protected AnimationEngine.Sandwich getSandwich(AnimationTarget target, short type, java.lang.String ns, java.lang.String an)
protected AnimationEngine.TargetInfo getTargetInfo(AnimationTarget target)
protected AnimationEngine.AnimationInfo getAnimationInfo(AbstractAnimation anim)
protected float tick(float time, boolean hyperlinking)
time
- the document time to sample athyperlinking
- whether the document should be seeked to the given
time, as with hyperlinkingpublic void toActive(AbstractAnimation anim, float begin)
anim
- the animationbegin
- the time the element became active, in document simple timeprotected void pushDown(AbstractAnimation anim)
public void toInactive(AbstractAnimation anim, boolean isFrozen)
anim
- the animationisFrozen
- whether the element is frozen or notpublic void removeFill(AbstractAnimation anim)
protected void moveToTop(AbstractAnimation anim)
protected void moveToBottom(AbstractAnimation anim)
public void addTimegraphListener(TimegraphListener l)
TimegraphListener
to the document.public void removeTimegraphListener(TimegraphListener l)
TimegraphListener
from the document.public void sampledAt(AbstractAnimation anim, float simpleTime, float simpleDur, int repeatIteration)
anim
- the animationsimpleTime
- the sample time in local simple timesimpleDur
- the simple duration of the elementrepeatIteration
- the repeat iteration during which the element was
sampledpublic void sampledLastValue(AbstractAnimation anim, int repeatIteration)
protected abstract TimedDocumentRoot createDocumentRoot()
Copyright © 2022 Apache Software Foundation. All Rights Reserved.