1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
---
title: AnimationEvent
slug: Web/API/AnimationEvent
tags:
- API
- Experimental
- Interface
- NeedsTranslation
- Reference
- TopicStub
- Web Animations
translation_of: Web/API/AnimationEvent
---
<div>{{SeeCompatTable}}{{APIRef("Web Animations API")}}</div>
<p>The <strong><code>AnimationEvent</code></strong> interface represents events providing information related to <a href="/en-US/docs/Web/Guide/CSS/Using_CSS_animations">animations</a>.</p>
<p>{{InheritanceDiagram}}</p>
<h2 id="Constructor">Constructor</h2>
<dl>
<dt>{{domxref("AnimationEvent.AnimationEvent", "AnimationEvent()")}}</dt>
<dd>Creates an <code>AnimationEvent</code> event with the given parameters.</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p><em>Also inherits properties from its parent {{domxref("Event")}}</em>.</p>
<dl>
<dt>{{domxref("AnimationEvent.animationName")}} {{readonlyInline}}</dt>
<dd>Is a {{domxref("DOMString")}} containing the value of the {{cssxref("animation-name")}} CSS property associated with the transition.</dd>
<dt>{{domxref("AnimationEvent.elapsedTime")}} {{readonlyInline}}</dt>
<dd>Is a <code>float</code> giving the amount of time the animation has been running, in seconds, when this event fired, excluding any time the animation was paused. For an <code>animationstart</code> event, <code>elapsedTime</code> is <code>0.0</code> unless there was a negative value for {{cssxref("animation-delay")}}, in which case the event will be fired with <code>elapsedTime</code> containing <code>(-1 * <var>delay</var>)</code>.</dd>
<dt>{{domxref("AnimationEvent.pseudoElement")}} {{readonlyInline}}</dt>
<dd>Is a {{domxref("DOMString")}}, starting with <code>'::'</code>, containing the name of the <a href="/en-US/docs/Web/CSS/Pseudo-elements">pseudo-element</a> the animation runs on. If the animation doesn't run on a pseudo-element but on the element, an empty string: <code>''</code>.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em>Also inherits methods from its parent {{domxref("Event")}}</em>.</p>
<dl>
<dt>{{domxref("AnimationEvent.initAnimationEvent()")}} {{non-standard_inline}}{{deprecated_inline}}</dt>
<dd>Initializes a <code>AnimationEvent</code> created using the deprecated {{domxref("Document.createEvent()", "Document.createEvent(\"AnimationEvent\")")}} method.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName("CSS3 Animations", "#interface-animationevent", "AnimationEvent")}}</td>
<td>{{Spec2("CSS3 Animations")}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("api.AnimationEvent")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/CSS/Using_CSS_animations">Using CSS animations</a></li>
<li>Animation-related CSS properties and at-rules: {{cssxref("animation")}}, {{cssxref("animation-delay")}}, {{cssxref("animation-direction")}}, {{cssxref("animation-duration")}}, {{cssxref("animation-fill-mode")}}, {{cssxref("animation-iteration-count")}}, {{cssxref("animation-name")}}, {{cssxref("animation-play-state")}}, {{cssxref("animation-timing-function")}}, {{cssxref("@keyframes")}}.</li>
</ul>
|