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