--- title: Animation.finished slug: Web/API/Animation/finished translation_of: Web/API/Animation/finished ---
{{ SeeCompatTable() }}{{ APIRef("Web Animations API") }}
Animation.finished只读属性允许您返回动画的完成状态。
Note: The Promise is replaced with a new (pending) Promise object every time the animation leaves the finished
play state.
var animationsPromise = animation.finished;
一个Promise对象。
以下代码会等到所有动画都完成,然后再移除它们处于活动状态的元素:
Promise.all( elem.getAnimations().map( function(animation) { return animation.finished } ) ).then( function() { return elem.remove(); } );
Specification | Status | Comment |
---|---|---|
{{SpecName('Web Animations', '#dom-animation-finished', 'Animation.finished' )}} | {{Spec2('Web Animations')}} | Editor's draft. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |