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.- Version:
- $Id: SVGAnimationEngine.java 1851346 2019-01-15 13:41:00Z ssteiner $
-
-
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.AnimatableLengthOrIdentFactoryanimatableLengthOrIdentFactoryThe factory for length-or-ident values.protected SVGAnimationEngine.AnimatableNumberOrIdentFactoryanimatableNumberOrIdentFactoryThe factory for number-or-ident values.protected static java.util.SetanimationEventNames11Set of SMIL animation event names for SVG 1.1.protected static java.util.SetanimationEventNames12Set of SMIL animation event names for SVG 1.2.protected floatanimationLimitingAmountThe amount of animation limiting.protected intanimationLimitingModeThe animation limiting mode.protected SVGAnimationEngine.AnimationThreadanimationThreadThe thread that ticks the animation engine.protected SVGAnimationEngine.AnimationTickRunnableanimationTickRunnableThe Runnable that ticks the document.protected CSSEnginecssEngineThe CSSEngine used for CSS value parsing.protected BridgeContextctxThe BridgeContext to use for value parsing.protected StyleMapdummyStyleMapA StyleMap used by theSVGAnimationEngine.Factorys when computing CSS values.protected SVGAnimationEngine.Factory[]factoriesFactories forAnimatableValueparsing.protected java.util.LinkedListinitialBridgesList of bridges that will be initialized when the document is started.protected floatinitialStartTimeThe initial time that will be seeked to when the animation engine starts, as set bysetCurrentTime(float).protected booleanisSVG12Whether the document is an SVG 1.2 document.protected booleanstartedWhether animation processing has started.protected SVGAnimationEngine.UncomputedAnimatableStringValueFactoryuncomputedAnimatableStringValueFactoryThe 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 voidaddInitialBridge(SVGAnimationElementBridge b)Adds an animation element bridge to the list of bridges that require initializing when the document is started.protected TimedDocumentRootcreateDocumentRoot()Creates a new returns a new TimedDocumentRoot object for the document.voiddispose()Disposes this animation engine.floatgetCurrentTime()Returns the current document time.AnimatableValuegetUnderlyingCSSValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String pn)Returns an AnimatableValue for the underlying value of a CSS property.booleanhasStarted()Returns whether animation processing has begun.AnimatableValueparseAnimatableValue(org.w3c.dom.Element animElt, AnimationTarget target, java.lang.String ns, java.lang.String ln, boolean isCSS, java.lang.String s)Parses an AnimatableValue.voidpause()Pauses the animations.voidsetAnimationLimitingCPU(float pc)Sets the animation limiting mode to a percentage of CPU.voidsetAnimationLimitingFPS(float fps)Sets the animation limiting mode to a number of frames per second.voidsetAnimationLimitingNone()Sets the animation limiting mode to "none".floatsetCurrentTime(float t)Sets the current document time.voidstart(long documentStartTime)Starts the animation engine.voidunpause()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 forAnimatableValueparsing.
-
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.Factorys 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:
disposein 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:
pausein classAnimationEngine
-
unpause
public void unpause()
Pauses the animations.- Overrides:
unpausein classAnimationEngine
-
getCurrentTime
public float getCurrentTime()
Returns the current document time.- Overrides:
getCurrentTimein classAnimationEngine
-
setCurrentTime
public float setCurrentTime(float t)
Sets the current document time.- Overrides:
setCurrentTimein classAnimationEngine
-
createDocumentRoot
protected TimedDocumentRoot createDocumentRoot()
Creates a new returns a new TimedDocumentRoot object for the document.- Specified by:
createDocumentRootin 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)
-
-