这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
getAnimations()
方法在
元素
interface (specified on the
Animatable
mixin) returns an array of all
动画
objects affecting this element or which are scheduled to do so in future. It can optionally return
动画
objects for descendant elements too.
注意 : This array includes CSS 动画 , CSS Transitions ,和 Web 动画 .
const animations = Element.getAnimations(options);
选项
可选
An options object containing the following property:
subtree
true
, causes animations that target descendants of
元素
to be returned as well. This includes animations that target any CSS
pseudo-elements
attached to
元素
or one of its descendents. Defaults to
false
.
数组
of
动画
objects, each representing an animation currently targetting the
元素
on which this method is called, or one of its descendant elements if
{ subtree: true }
被指定。
The following code snippet will wait for all animations on
elem
and its descendants to finish before removing the element from the document.
Promise.all(
elem.getAnimations({ subtree: true })
.map(animation => animation.finished)
).then(() => elem.remove());
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 动画
The definition of 'Animatable.getAnimations()' in that specification. |
工作草案 | 编者草案。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAnimations
|
Chrome
79
Disabled
|
Edge
79
Disabled
|
Firefox
75
|
IE No |
Opera
66
Disabled
|
Safari
部分支持
Partial
Disabled
|
WebView Android No |
Chrome Android
79
Disabled
|
Firefox Android
63
Disabled
|
Opera Android
部分支持
48
Disabled
|
Safari iOS
部分支持
Partial
Disabled
|
Samsung Internet Android No |
完整支持
部分支持
不支持
实验。期望将来行为有所改变。
见实现注意事项。
用户必须明确启用此特征。
使用非标名称。
Document.getAnimations()
- Fetch all animations in the document
动画
元素
accessKey
属性
childElementCount
children
classList
className
clientHeight
clientLeft
clientTop
clientWidth
currentStyle
firstElementChild
id
innerHTML
lastElementChild
localName
名称
namespaceURI
nextElementSibling
onfullscreenchange
onfullscreenerror
openOrClosedShadowRoot
outerHTML
part
prefix
previousElementSibling
runtimeStyle
scrollHeight
scrollLeft
scrollLeftMax
scrollTop
scrollTopMax
scrollWidth
shadowRoot
slot
tabStop
tagName
after()
animate()
append()
attachShadow()
before()
closest()
computedStyleMap()
createShadowRoot()
getAnimations()
getAttribute()
getAttributeNames()
getAttributeNode()
getAttributeNodeNS()
getAttributeNS()
getBoundingClientRect()
getClientRects()
getElementsByClassName()
getElementsByTagName()
getElementsByTagNameNS()
hasAttribute()
hasAttributeNS()
hasAttributes()
hasPointerCapture()
insertAdjacentElement()
insertAdjacentHTML()
insertAdjacentText()
matches()
msZoomTo()
prepend()
querySelector()
querySelector()
querySelectorAll()
querySelectorAll()
releasePointerCapture()
remove()
removeAttribute()
removeAttributeNode()
removeAttributeNS()
replaceChildren()
replaceWith()
requestFullscreen()
requestPointerLock()
scroll()
scrollBy()
scrollIntoView()
scrollIntoViewIfNeeded()
scrollTo()
setAttribute()
setAttributeNode()
setAttributeNodeNS()
setAttributeNS()
setCapture()
setPointerCapture()
toggleAttribute()
afterscriptexecute
auxclick
blur
click
compositionend
compositionstart
compositionupdate
contextmenu
copy
cut
dblclick
DOMActivate
DOMMouseScroll
error
focus
focusin
focusout
fullscreenchange
fullscreenerror
gesturechange
gestureend
gesturestart
keydown
keypress
keyup
mousedown
mouseenter
mouseleave
mousemove
mouseout
mouseover
mouseup
mousewheel
MozMousePixelScroll
msContentZoom
MSGestureChange
MSGestureEnd
MSGestureHold
MSGestureStart
MSGestureTap
MSInertiaStart
MSManipulationStateChanged
overflow
paste
scroll
select
show
touchcancel
touchend
touchmove
touchstart
underflow
webkitmouseforcechanged
webkitmouseforcedown
webkitmouseforceup
webkitmouseforcewillbegin
wheel