Web Animations API
Animation.finished 只读属性允许你返回动画的完成状态。
[!NOTE] The Promise is replaced with a new (pending) Promise object every time the animation leaves the
finishedplay state.
语法
var animationsPromise = animation.finished;
值
一个 Promise 对象。
例子
以下代码会等到所有动画都完成,然后再移除它们处于活动状态的元素:
Promise.all(
elem.getAnimations().map(function (animation) {
return animation.finished;
}),
).then(function () {
return elem.remove();
});
规范
浏览器兼容性
参见
- KeyframeEffect Interface
- Web Animations API
- Animation
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
