Animation: cancel() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2020.

ウェブアニメーション API の cancel()Animation インターフェイスのメソッドで、このアニメーションによって引き起こされたすべての KeyframeEffectを初期化し、再生を中止します。

メモ: アニメ―ションをキャンセルした時、startTimecurrentTime は、 null に設定されます。

構文

js
cancel()

引数

なし。

返値

なし。

例外

このメソッドは、直接は例外を発生しません。しかし、キャンセル時にアニメーションの playState"idle" 以外の場合、 current finished promiseDOMExceptionAbortError で拒否されます。

仕様書

Specification
Web Animations
# dom-animation-cancel

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
cancel

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報