Animation: cancel() メソッド

Baseline 2022

Newly available

Since September 2022, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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

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

構文

js
cancel()

引数

なし。

返値

なし。

例外

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

仕様書

Specification
Web Animations
# dom-animation-cancel

ブラウザーの互換性

BCD tables only load in the browser

関連情報