The AnimationEvent.initAnimationEvent() method Initializes an animation event created using the deprecated Document.createEvent("AnimationEvent") method.

AnimationEvent created this way are untrusted.

備註: During the standardization process, this method was removed from the specification. It has been deprecated and is in the progress of being removed from most implementations. Do not use this method; instead, use the standard constructor, AnimationEvent(), to create a synthetic AnimationEvent.


animationEvent.initAnimationEvent(typeArg, canBubbleArg, cancelableArg, animationNameArg, elapsedTimeArg);



A DOMString identifying the specific type of animation event that occurred. The following values are allowed:

Value Meaning
animationstart The animation has started.
animationend The animation completed.
animationiteration The current iteration just completed.

A Boolean (en-US) flag indicating if the event can bubble (true) or not (false).


A Boolean (en-US) flag indicating if the event associated action can be avoided (true) or not (false).


A DOMString containing the value of the animation-name (en-US) CSS property associated with the transition.


A float indicating the amount of time the animation has been running, in seconds, as of the time the event was fired, excluding any time the animation was paused. For an "animationstart" event, elapsedTime is 0.0 unless there was a negative value for animation-delay (en-US), in which case the event will be fired with elapsedTime containing (-1 * delay).


CSS Animations Level 1
# dom-animationevent-animationevent

Browser compatibility

BCD tables only load in the browser

See also