--- title: 'Document: animationend イベント' slug: Web/API/Document/animationend_event tags: - CSS Animations - CSS アニメーション - Document - Event - Reference - Web - animationend - イベント translation_of: Web/API/Document/animationend_event ---
animationend イベントは、 CSS アニメーションが完了したときに発生します。アニメーションが完了前に中止された場合、例えば要素が DOM から削除されたりアニメーションが要素から削除されたりした場合、 animationend イベントは発生しません。
| バブリング | あり |
|---|---|
| キャンセル | 不可 |
| インターフェイス | {{domxref("AnimationEvent")}} |
| イベントハンドラープロパティ | {{domxref("GlobalEventHandlers/onanimationend","onanimationend")}} |
このイベントの本来の対象は、トランジションが適用された {{domxref("Element")}} です。このイベントを {{domxref("Document")}} インターフェイス上で待ち受けし、キャプチャやバブリングの局面で処理することができます。このイベントについて完全な詳細は、 HTMLElement: animationend イベントを参照してください。
この例は animationend イベントを待ち受けます。
document.addEventListener('animationend', () => {
console.log('アニメーション終了');
});
同様に、 onanimationend イベントハンドラープロパティを使用するとこうなります。
document.onanimationend = () => {
console.log('アニメーション終了');
};
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName("CSS3 Animations", "#eventdef-animationevent-animationend")}} | {{Spec2("CSS3 Animations")}} | 初回定義 |
{{Compat("api.Document.animationend_event")}}