SVGAnimationElement

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。

The SVGAnimationElement interface is the base interface for all of the animation element interfaces: SVGAnimateElement, SVGSetElement, SVGAnimateColorElement, SVGAnimateMotionElement and SVGAnimateTransformElement.

Properties

This interface also inherits properties from its parent, SVGElement.

SVGAnimationElement.targetElement Read only
An SVGElement representing the element which is being animated. If no target element is being animated (for example, because the href specifies an unknown element) the value returned is null.

Methods

This interface also inherits methods from its parent, SVGElement.

SVGAnimationElement.getStartTime()
Returns a float representing the begin time, in seconds, for this animation element's current interval, if it exists, regardless of whether the interval has begun yet. If there is no current interval, then a DOMException with code INVALID_STATE_ERR is thrown.
SVGAnimationElement.getCurrentTime()
Returns a float representing the current time in seconds relative to time zero for the given time container.
SVGAnimationElement.getSimpleDuration()
Returns a float representing the number of seconds for the simple duration for this animation. If the simple duration is undefined (e.g., the end time is indefinite), then a DOMException with code NOT_SUPPORTED_ERR is raised.
SVGAnimationElement.beginElement()
Creates a begin instance time for the current time. The new instance time is added to the begin instance times list. The behavior of this method is equivalent to beginElementAt(0).
SVGAnimationElement.beginElementAt()

Creates a begin instance time for the current time plus the specified offset. The new instance time is added to the begin instance times list.

SVGAnimationElement.endElement()

Creates an end instance time for the current time. The new instance time is added to the end instance times list. The behavior of this method is equivalent to endElementAt(0).

SVGAnimationElement.endElementAt()
Creates a end instance time for the current time plus the specified offset. The new instance time is added to the end instance times list.

Events

Listen to these events using addEventListener() or by assigning an event listener to the on... handler property of this interface.

beginEvent
Fired when the element local timeline begins to play.
Also available via the onbegin property.
endEvent
Fired when at the active end of the animation is reached.
Also available via the onend property.
repeatEvent
Fired when the element's local timeline repeats. It will be fired each time the element repeats, after the first iteration.
Also available via the onrepeat property.

Specifications

Specification Status Comment
SVG Animations Level 2
The definition of 'SVGAnimationElement' in that specification.
Editor's Draft  
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'SVGAnimationElement' in that specification.
Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
SVGAnimationElementChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
onbeginChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
beginEvent eventChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
endEvent eventChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
onendChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android ? Chrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
onrepeatChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari No support NoWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
repeatEvent eventChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
targetElementChrome Full support YesEdge No support NoFirefox Full support YesIE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile No support NoFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

最后编辑者: chrisdavidmills,