AnimationEvent: AnimationEvent() コンストラクター

Baseline Widely available

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

AnimationEvent() コンストラクターは、アニメーションに関するイベントを表す新しい AnimationEvent オブジェクトを返します。

構文

js
new AnimationEvent(type)
new AnimationEvent(type, options)

引数

type

AnimationEvent の型名を表す文字列です。 大文字と小文字を区別し、ブラウザーでは animationstart, animationend, animationiteration のいずれかに設定されます。

options 省略可

オブジェクトで、Event() で定義されているプロパティに加えて、以下のプロパティがあります。

animationName 省略可

トランジションに関連付けられた animation-name の値を含む文字列です。遷移に関連付けられた CSS プロパティの値です。既定値は "" です。

elapsedTime 省略可

float で、このイベントが発行されたときにアニメーションが動作していた時間(アニメーションが一時停止していた時間を除く)を秒単位で与えます。 animationstart イベントの場合、 elapsedTime0.0 です。ただし、 animation-delay に負の値を指定した場合は除きます。 この場合、イベントは elapsedTime(-1 * delay) が含まれた状態で発行されます。既定で 0.0 となります。

pseudoElement 省略可

文字列で、アニメーションを動作させる擬似要素の名前を含む、 "::" で始まる名前です。もしアニメーションが擬似要素上で動作せず、要素そのもの上で動作するる場合は、空文字列 "" を指定します。 既定では "" となります。

仕様書

Specification
CSS Animations Level 1
# dom-animationevent-animationevent

ブラウザーの互換性

BCD tables only load in the browser

関連情報