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 2020年3月.
ウェブアニメーション API の cancel() は Animation インターフェイスのメソッドで、このアニメーションによって引き起こされたすべての KeyframeEffectを初期化し、再生を中止します。
メモ:
アニメ―ションをキャンセルした時、startTime と currentTime は、 null に設定されます。
構文
js
cancel()
引数
なし。
返値
なし。
例外
このメソッドは、直接は例外を発生しません。しかし、キャンセル時にアニメーションの playState が "idle" 以外の場合、 current finished promise は DOMException の AbortError で拒否されます。
仕様書
| Specification |
|---|
| Web Animations> # dom-animation-cancel> |
ブラウザーの互換性
Loading…
関連情報
- ウェブアニメーション API
KeyframeEffectAnimationAnimation.playStateAnimation.finishedはこのアニメーションのplayStateが"idle"でなくなると拒否されるこの操作のプロミスを返します。