AnimationEvent

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

AnimationEvent interface represents events providing information related to animations .

构造函数

AnimationEvent()
创建 AnimationEvent event with the given parameters.

特性

Also inherits properties from its parent Event .

AnimationEvent.animationName 只读
DOMString containing the value of the animation-name that generated the animation.
AnimationEvent.elapsedTime 只读
float giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. For an animationstart event, elapsedTime is 0.0 unless there was a negative value for animation-delay , in which case the event will be fired with elapsedTime containing (-1 * delay ) .
AnimationEvent.pseudoElement 只读
DOMString , starting with '::' , containing the name of the pseudo-element the animation runs on. If the animation doesn't run on a pseudo-element but on the element, an empty string: '' .

方法

Also inherits methods from its parent Event .

AnimationEvent.initAnimationEvent()
Initializes a AnimationEvent created using the deprecated Document.createEvent("AnimationEvent") 方法。

规范

规范 状态 Comment
CSS Animations
The definition of 'AnimationEvent' in that specification.
工作草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
AnimationEvent
Chrome 43
43
不支持 1 — 70
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
Edge 12 Firefox 6 IE 10 Opera 30
30
不支持 15 — 57
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
不支持 12.1 — 15
12
Prefixed
Prefixed Implemented with the vendor prefix: o
Safari 9.1
9.1
4
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
WebView Android 43
43
不支持 1 — 70
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
Chrome Android 43
43
不支持 18 — 70
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
Firefox Android 6 Opera Android 30
30
不支持 14 — 49
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
不支持 12.1 — 14
12
Prefixed
Prefixed Implemented with the vendor prefix: o
Safari iOS 9.3
9.3
3.2
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
Samsung Internet Android 4.0
4.0
不支持 1.0 — 10.0
Prefixed
Prefixed Implemented with the vendor prefix: WebKit
AnimationEvent() 构造函数
Chrome 43 Edge ≤79 Firefox 23 IE No Opera No Safari No WebView Android 43 Chrome Android 43 Firefox Android 23 Opera Android No Safari iOS ? Samsung Internet Android 4.0
animationName
Chrome 43 Edge 12 Firefox 6 IE 10 Opera 30 Safari 9 WebView Android 43 Chrome Android 43 Firefox Android 6 Opera Android 30 Safari iOS 9 Samsung Internet Android 4.0
elapsedTime
Chrome 43 Edge 12 Firefox 6 IE 10 Opera 30 Safari 9 WebView Android 43 Chrome Android 43 Firefox Android 6 Opera Android 30 Safari iOS 9 Samsung Internet Android 4.0
initAnimationEvent
弃用 非标
Chrome 1 — 18
Alternate Name
不支持 1 — 18
Alternate Name
Alternate Name Uses the non-standard name: initWebKitAnimationEvent
Edge 12 — 16 Firefox 6 — 23 IE 10 Opera 12.1 — 15 Safari 4 — 6
Alternate Name
不支持 4 — 6
Alternate Name
Alternate Name Uses the non-standard name: initWebKitAnimationEvent
WebView Android No Chrome Android No Firefox Android 6 — 23 Opera Android 12.1 — 14 Safari iOS 3.2 — 6
Alternate Name
不支持 3.2 — 6
Alternate Name
Alternate Name Uses the non-standard name: initWebKitAnimationEvent
Samsung Internet Android No
pseudoElement
Chrome 68 Edge 79 Firefox 23 IE No Opera No Safari No WebView Android 68 Chrome Android 68 Firefox Android 23 Opera Android No Safari iOS No Samsung Internet Android 10.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
弃用。不要用于新网站。
使用非标名称。
要求使用供应商前缀或不同名称。
要求使用供应商前缀或不同名称。

另请参阅