Package org.apache.batik.bridge
Class SVGAnimationEngine
- java.lang.Object
-
- org.apache.batik.anim.AnimationEngine
-
- org.apache.batik.bridge.SVGAnimationEngine
-
public class SVGAnimationEngine extends AnimationEngine
An AnimationEngine for SVG documents.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.batik.anim.AnimationEngine
AnimationEngine.AnimationInfo, AnimationEngine.Listener, AnimationEngine.Sandwich, AnimationEngine.TargetInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected SVGAnimationEngine.AnimatableLengthOrIdentFactory
animatableLengthOrIdentFactory
The factory for length-or-ident values.protected SVGAnimationEngine.AnimatableNumberOrIdentFactory
animatableNumberOrIdentFactory
The factory for number-or-ident values.protected static java.util.Set
animationEventNames11
Set of SMIL animation event names for SVG 1.1.protected static java.util.Set
animationEventNames12
Set of SMIL animation event names for SVG 1.2.protected float
animationLimitingAmount
The amount of animation limiting.protected int
animationLimitingMode
The animation limiting mode.protected SVGAnimationEngine.AnimationThread
animationThread
The thread that ticks the animation engine.protected SVGAnimationEngine.AnimationTickRunnable
animationTickRunnable
The Runnable that ticks the document.protected CSSEngine
cssEngine
The CSSEngine used for CSS value parsing.protected BridgeContext
ctx
The BridgeContext to use for value parsing.protected StyleMap
dummyStyleMap
A StyleMap used by theSVGAnimationEngine.Factory
s when computing CSS values.protected SVGAnimationEngine.Factory[]
factories
Factories forAnimatableValue
parsing.protected java.util.LinkedList
initialBridges
List of bridges that will be initialized when the document is started.protected float
initialStartTime
The initial time that will be seeked to when the animation engine starts, as set bysetCurrentTime(float)
.protected boolean
isSVG12
Whether the document is an SVG 1.2 document.protected boolean
started
Whether animation processing has started.protected SVGAnimationEngine.UncomputedAnimatableStringValueFactory
uncomputedAnimatableStringValueFactory
The factory for unparsed string values.-
Fields inherited from class org.apache.batik.anim.AnimationEngine
ANIM_TYPE_CSS, ANIM_TYPE_OTHER, ANIM_TYPE_XML, animations, document, MAP_ENTRY_ARRAY, pauseTime, targetListener, targets, timedDocumentRoot
-
-
Constructor Summary
Constructors Constructor Description SVGAnimationEngine(org.w3c.dom.Document doc, BridgeContext ctx)
Creates a new SVGAnimationEngine.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInitialBridge(SVGAnimationElementBridge b)
Adds an animation element bridge to the list of bridges that require initializing when the document is started.protected TimedDocumentRoot
createDocumentRoot()
Creates a new returns a new TimedDocumentRoot object for the document.void
dispose()
Disposes this animation engine.float
getCurrentTime()
Returns the current document time.AnimatableValue
getUnderlyingCSSValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String pn)
Returns an AnimatableValue for the underlying value of a CSS property.boolean
hasStarted()
Returns whether animation processing has begun.AnimatableValue
parseAnimatableValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String ns, java.lang.String ln, boolean isCSS, java.lang.String s)
Parses an AnimatableValue.void
pause()
Pauses the animations.void
setAnimationLimitingCPU(float pc)
Sets the animation limiting mode to a percentage of CPU.void
setAnimationLimitingFPS(float fps)
Sets the animation limiting mode to a number of frames per second.void
setAnimationLimitingNone()
Sets the animation limiting mode to "none".float
setCurrentTime(float t)
Sets the current document time.void
start(long documentStartTime)
Starts the animation engine.void
unpause()
Pauses the animations.-
Methods inherited from class org.apache.batik.anim.AnimationEngine
addAnimation, addTimegraphListener, getAnimationInfo, getSandwich, getTargetInfo, isPaused, moveToBottom, moveToTop, pushDown, removeAnimation, removeFill, removeTimegraphListener, sampledAt, sampledLastValue, tick, toActive, toInactive
-
-
-
-
Field Detail
-
ctx
protected BridgeContext ctx
The BridgeContext to use for value parsing.
-
cssEngine
protected CSSEngine cssEngine
The CSSEngine used for CSS value parsing.
-
started
protected boolean started
Whether animation processing has started. This affects whether animation element bridges add their animation on to the initial bridge list, or process them immediately.
-
animationTickRunnable
protected SVGAnimationEngine.AnimationTickRunnable animationTickRunnable
The Runnable that ticks the document.
-
initialStartTime
protected float initialStartTime
The initial time that will be seeked to when the animation engine starts, as set bysetCurrentTime(float)
.
-
uncomputedAnimatableStringValueFactory
protected SVGAnimationEngine.UncomputedAnimatableStringValueFactory uncomputedAnimatableStringValueFactory
The factory for unparsed string values.
-
animatableLengthOrIdentFactory
protected SVGAnimationEngine.AnimatableLengthOrIdentFactory animatableLengthOrIdentFactory
The factory for length-or-ident values.
-
animatableNumberOrIdentFactory
protected SVGAnimationEngine.AnimatableNumberOrIdentFactory animatableNumberOrIdentFactory
The factory for number-or-ident values.
-
factories
protected SVGAnimationEngine.Factory[] factories
Factories forAnimatableValue
parsing.
-
isSVG12
protected boolean isSVG12
Whether the document is an SVG 1.2 document.
-
initialBridges
protected java.util.LinkedList initialBridges
List of bridges that will be initialized when the document is started.
-
dummyStyleMap
protected StyleMap dummyStyleMap
A StyleMap used by theSVGAnimationEngine.Factory
s when computing CSS values.
-
animationThread
protected SVGAnimationEngine.AnimationThread animationThread
The thread that ticks the animation engine.
-
animationLimitingMode
protected int animationLimitingMode
The animation limiting mode.
-
animationLimitingAmount
protected float animationLimitingAmount
The amount of animation limiting.
-
animationEventNames11
protected static final java.util.Set animationEventNames11
Set of SMIL animation event names for SVG 1.1.
-
animationEventNames12
protected static final java.util.Set animationEventNames12
Set of SMIL animation event names for SVG 1.2.
-
-
Constructor Detail
-
SVGAnimationEngine
public SVGAnimationEngine(org.w3c.dom.Document doc, BridgeContext ctx)
Creates a new SVGAnimationEngine.
-
-
Method Detail
-
dispose
public void dispose()
Disposes this animation engine.- Overrides:
dispose
in classAnimationEngine
-
addInitialBridge
public void addInitialBridge(SVGAnimationElementBridge b)
Adds an animation element bridge to the list of bridges that require initializing when the document is started.
-
hasStarted
public boolean hasStarted()
Returns whether animation processing has begun.
-
parseAnimatableValue
public AnimatableValue parseAnimatableValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String ns, java.lang.String ln, boolean isCSS, java.lang.String s)
Parses an AnimatableValue.
-
getUnderlyingCSSValue
public AnimatableValue getUnderlyingCSSValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String pn)
Returns an AnimatableValue for the underlying value of a CSS property.
-
pause
public void pause()
Pauses the animations.- Overrides:
pause
in classAnimationEngine
-
unpause
public void unpause()
Pauses the animations.- Overrides:
unpause
in classAnimationEngine
-
getCurrentTime
public float getCurrentTime()
Returns the current document time.- Overrides:
getCurrentTime
in classAnimationEngine
-
setCurrentTime
public float setCurrentTime(float t)
Sets the current document time.- Overrides:
setCurrentTime
in classAnimationEngine
-
createDocumentRoot
protected TimedDocumentRoot createDocumentRoot()
Creates a new returns a new TimedDocumentRoot object for the document.- Specified by:
createDocumentRoot
in classAnimationEngine
-
start
public void start(long documentStartTime)
Starts the animation engine.
-
setAnimationLimitingNone
public void setAnimationLimitingNone()
Sets the animation limiting mode to "none".
-
setAnimationLimitingCPU
public void setAnimationLimitingCPU(float pc)
Sets the animation limiting mode to a percentage of CPU.- Parameters:
pc
- the maximum percentage of CPU to use (0 < pc ≤ 1)
-
setAnimationLimitingFPS
public void setAnimationLimitingFPS(float fps)
Sets the animation limiting mode to a number of frames per second.- Parameters:
fps
- the maximum number of frames per second (fps > 0)
-
-