-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
915 lines (906 loc) · 82.8 KB
/
Overview.html
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>CSS Animations Level 2</title>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<meta content="exploring" name="csswg-work-status">
<meta content="ED" name="w3c-status">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
body {
background-image: url("https://www.w3.org/StyleSheets/TR/logo-ED");
};
</style>
<meta content="Bikeshed 1.0.0" name="generator">
<style type="text/css">
table.play-state-transitions {
empty-cells: hide;
border-spacing: 0px;
}
table.play-state-transitions td {
padding: 0.2em 1em;
border: 1px solid black;
}
table.play-state-transitions th.rowgroup {
transform: rotate(-180deg);
writing-mode: vertical-lr;
padding-left: 5px;
}
</style>
<style>
.dfn-panel {
display: inline-block;
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel > span { display: list-item; list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: .5em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">CSS Animations Level 2</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-04-28">28 April 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://drafts.csswg.org/css-animations-2/">https://drafts.csswg.org/css-animations-2/</a>
<dt>Feedback:
<dd><span><a href="mailto:www-style@w3.org?subject=%5Bcss-animations-2%5D%20YOUR%20TOPIC%20HERE">www-style@w3.org</a> with subject line “<kbd>[css-animations-2] <i data-lt="">… message topic …</i></kbd>” (<a href="http://lists.w3.org/Archives/Public/www-style/" rel="discussion">archives</a>)</span>
<dt>Issue Tracking:
<dd><a href="#issues-index">Inline In Spec</a>
<dt class="editor">Editor:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:dbaron@dbaron.org">L. David Baron</a> (<span class="p-org org">Mozilla</span>)
<dt>Issues List:
<dd><span><a href="https://www.w3.org/Bugs/Public/buglist.cgi?component=Animations&list_id=36653&product=CSS&query_format=advanced&resolution=---">In Bugzilla</a></span>
<dd><span></span>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2016 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>This CSS module describes a way for authors to animate the values of CSS properties over time, using keyframes. The behavior of these keyframe animations can be controlled by specifying their duration, number of repeats, and repeating behavior.</p>
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, in speech, etc.
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress. </p>
<p> The (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-animations-2%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a> (see <a href="http://www.w3.org/Mail/Request">instructions</a>)
is preferred for discussion of this specification.
When sending e-mail,
please put the text “css-animations-2” in the subject,
preferably like this:
“[css-animations-2] <em>…summary of comment…</em>” </p>
<p> This document was produced by the <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of the <a href="http://www.w3.org/Style/">Style Activity</a>). </p>
<p> This document was produced by a group operating under
the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group;
that page also includes instructions for disclosing a patent.
An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
<p> This document is governed by the <a href="http://www.w3.org/2015/Process-20150901/" id="w3c_process_revision">1 September 2015 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#delta"><span class="secno">1</span> <span class="content">Delta specification</span></a>
<li>
<a href="#animations"><span class="secno">2</span> <span class="content">Animations</span></a>
<ol class="toc">
<li><a href="#owning-element-section"><span class="secno">2.1</span> <span class="content">Owning element</span></a>
<li><a href="#animation-composite-order"><span class="secno">2.2</span> <span class="content">Animation composite order</span></a>
</ol>
<li>
<a href="#keyframes"><span class="secno">3</span> <span class="content">Keyframes</span></a>
<ol class="toc">
<li>
<a href="#animation-play-state"><span class="secno">3.1</span> <span class="content">The <span class="property">animation-play-state</span> property</span></a>
<ol class="toc">
<li><a href="#interaction-between-animation-play-state-and-web-animations-API"><span class="secno">3.1.1</span> <span class="content">Interaction between <span class="property">animation-play-state</span> and the Web Animations API</span></a>
</ol>
<li><a href="#animation-composition"><span class="secno">3.2</span> <span class="content">The <span class="property">animation-composition</span> property</span></a>
</ol>
<li>
<a href="#events"><span class="secno">4</span> <span class="content">Animation Events</span></a>
<ol class="toc">
<li><a href="#event-animationevent"><span class="secno">4.1</span> <span class="content">Types of <code>AnimationEvent</code></span></a>
<li><a href="#event-dispatch"><span class="secno">4.2</span> <span class="content">Event dispatch</span></a>
</ol>
<li>
<a href="#interface-dom"><span class="secno">5</span> <span class="content">DOM Interfaces</span></a>
<ol class="toc">
<li><a href="#the-CSSAnimation-interface"><span class="secno">5.1</span> <span class="content">The CSSAnimation interface</span></a>
<li><a href="#requirements-on-pending-style-changes"><span class="secno">5.2</span> <span class="content">Requirements on pending style changes</span></a>
</ol>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<ol class="toc">
<li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
<li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
<li>
<a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
<ol class="toc">
<li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
<li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
<li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
</ol>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="delta"><span class="secno">1. </span><span class="content">Delta specification</span><a class="self-link" href="#delta"></a></h2>
<p>This is a delta specification, meaning that it currently contains
only the differences from CSS Animations Level 1 <a data-link-type="biblio" href="#biblio-css3-animations">[CSS3-ANIMATIONS]</a>.
Once the Level 1 specification is closer to complete, it will be merged
with the additions here into a complete level 2 specification.</p>
<h2 class="heading settled" data-level="2" id="animations"><span class="secno">2. </span><span class="content">Animations</span><a class="self-link" href="#animations"></a></h2>
<h3 class="heading settled" data-level="2.1" id="owning-element-section"><span class="secno">2.1. </span><span class="content">Owning element</span><a class="self-link" href="#owning-element-section"></a></h3>
<p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="owning element" data-noexport="" id="owning-element">owning element<span class="dfn-panel" data-deco=""><b><a href="#owning-element">#owning-element</a></b><b>Referenced in:</b><span><a href="#ref-for-owning-element-1">2.1. Owning element</a> <a href="#ref-for-owning-element-2">(2)</a> <a href="#ref-for-owning-element-3">(3)</a> <a href="#ref-for-owning-element-4">(4)</a> <a href="#ref-for-owning-element-5">(5)</a> <a href="#ref-for-owning-element-6">(6)</a></span><span><a href="#ref-for-owning-element-7">2.2. Animation composite order</a> <a href="#ref-for-owning-element-8">(2)</a> <a href="#ref-for-owning-element-9">(3)</a> <a href="#ref-for-owning-element-10">(4)</a> <a href="#ref-for-owning-element-11">(5)</a> <a href="#ref-for-owning-element-12">(6)</a> <a href="#ref-for-owning-element-13">(7)</a> <a href="#ref-for-owning-element-14">(8)</a> <a href="#ref-for-owning-element-15">(9)</a></span><span><a href="#ref-for-owning-element-16">3.1.1. Interaction between animation-play-state and the Web Animations API</a> <a href="#ref-for-owning-element-17">(2)</a></span></span></dfn> of an animation refers to the element or
pseudo-element to which the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> property was applied that generated
the animation.</p>
<p>If an animation was generated directly by script (e.g. using
the <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-1">CSSAnimation</a></code> constructor) then it has no <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-1">owning element</a>.</p>
<p>If an animation generated using the markup defined in this specification is
later disassociated from that markup by an update to the computed value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> property on the <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-2">owning element</a>, the animation is
disassociated from its <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-3">owning element</a> (that is, it has no <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-4">owning
element</a> from that point forwards).</p>
<div class="note" role="note">
<p>In the example below, <code>animation</code>’s initial <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-5">owning element</a> is <code>elem</code>. <code>animation</code> is disassociated from <code>element</code> through an update to the computed value of <code>elem</code>’s <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> property.</p>
<pre class="example lang-javascript" id="example-e0726753"><a class="self-link" href="#example-e0726753"></a>elem.style.animation = 'spin 1s';
let animation = elem.getAnimations()[0]; // animation’s owning element is elem
elem.style.animation = ''; // animation no longer has an owning element
</pre>
<p>Note that although the <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-6">owning element</a> is often equal to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-element">target
element</a> of an animation’s <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target effect</a>, this is not always the case.
The following example demonstrates some of the situations where these two
elements may differ.</p>
<pre class="example lang-javascript" id="example-6a58778b"><a class="self-link" href="#example-6a58778b"></a>elem.style.animation = 'move 1s';
let animation = elem.getAnimations()[0];
// animation.effect.target == elem == animation’s owning element
let mutableEffect = animation.effect.clone();
animation.effect = mutableEffect;
animation.effect.target = elem2;
// animation.effect.target == elem2 != animation’s owning element
animation.effect = null;
// animation.effect.target is undefined != animation’s owning element
</pre>
</div>
<h3 class="heading settled" data-level="2.2" id="animation-composite-order"><span class="secno">2.2. </span><span class="content">Animation composite order</span><a class="self-link" href="#animation-composite-order"></a></h3>
<p><a data-link-type="dfn" href="https://www.w3.org/TR/web-animations/#concept-animation">Animations</a> generated from the markup or interfaces
(e.g. the <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-2">CSSAnimation</a></code> constructor) defined in this specification have an <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#animation-class">animation class</a> of ‘CSS Animation’.</p>
<p>CSS Animations <em>with</em> an <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-7">owning element</a> have a <em>later</em> composite order than CSS Transitions but an <em>earlier</em> composite order
than animations without a specific <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#animation-class">animation class</a>.</p>
<p>Within the set of CSS Animations <em>with</em> an <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-8">owning element</a>, two
animations <var>A</var> and <var>B</var> are sorted in composite order (first to
last) as follows:</p>
<ol>
<li data-md="">
<p>If the <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-9">owning element</a> of <var>A</var> and <var>B</var> differs, sort <var>A</var> and <var>B</var> by <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-order">tree order</a> of their corresponding <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-10">owning elements</a>.
With regard to pseudo-elements, the sort order is as follows:</p>
<ul>
<li data-md="">
<p>element</p>
<li data-md="">
<p>::before</p>
<li data-md="">
<p>::after</p>
<li data-md="">
<p>element children</p>
</ul>
<li data-md="">
<p>Otherwise, sort <var>A</var> and <var>B</var> based on their position in the
computed value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> property of the (common) <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-11">owning
element</a>.</p>
</ol>
<p>The composite order of CSS Animations <em>without</em> an <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-12">owning element</a> is based on their position in the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#global-animation-list">global animation list</a>.</p>
<p class="issue" id="issue-ea70b453"><a class="self-link" href="#issue-ea70b453"></a> This differs from the behavior defined for transitions. We should
probably sort transitions first, then animation, then use the global animation
list. The reason being that when developer tools etc. hang on to orphaned
animations and transitions in order to replay them, they should maintain
roughly the same composite order.</p>
<p>CSS Animations generated using the markup defined in this specification are <em>not</em> added to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#global-animation-list">global animation list</a> when they are created.
Instead, these animations are appended to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#global-animation-list">global animation list</a> at
the first moment when they transition out of the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#idle-play-state">idle play state</a> after
being disassociated from their <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-13">owning element</a>.
CSS Animations that have been disassociated from their <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-14">owning element</a> but are still <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#idle-play-state">idle</a> do not have a defined
composite order.</p>
<p class="note" role="note">Note, this behavior relies on the fact that disassociating an animation
from its <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-15">owning element</a> always causes it to enter (or remain) in the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#idle-play-state">idle play state</a>.</p>
<p>CSS Animations created using the <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-3">CSSAnimation</a></code> constructor are appended
to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#global-animation-list">global animation list</a> at the moment they are constructed.</p>
<h2 class="heading settled" data-level="3" id="keyframes"><span class="secno">3. </span><span class="content">Keyframes</span><a class="self-link" href="#keyframes"></a></h2>
<h3 class="heading settled" data-level="3.1" id="animation-play-state"><span class="secno">3.1. </span><span class="content">The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> property</span><a class="self-link" href="#animation-play-state"></a></h3>
<h4 class="heading settled" data-level="3.1.1" id="interaction-between-animation-play-state-and-web-animations-API"><span class="secno">3.1.1. </span><span class="content">Interaction between <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> and the Web Animations API</span><a class="self-link" href="#interaction-between-animation-play-state-and-web-animations-API"></a></h4>
<p>Both this specification and the Web Animations specification <a data-link-type="biblio" href="#biblio-web-animations">[WEB-ANIMATIONS]</a> define mechanisms for pause control, specifically the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> property, and the <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#play">play()</a></code> and <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#pause">pause()</a></code> methods
respectively.</p>
<div class="note" role="note">
<p>The interaction of these methods can be summarized as follows:</p>
<ul>
<li data-md="">
<p>Calling <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#pause">pause()</a></code> is sticky. The animation will remain paused
until there is a subsequent call to <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#play">play()</a></code> after which point
the animation will begin tracking changes to the computed value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> property on the <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-16">owning element</a> from the next
moment it becomes newly <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>.</p>
<li data-md="">
<p>If the computed <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> on the <a data-link-type="dfn" href="#owning-element" id="ref-for-owning-element-17">owning element</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>, calling <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#play">play()</a></code> will temporarily override the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> until it next becomes <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-running">running</a>.</p>
</ul>
</div>
<p>With regards to the pausing, an animation can be considered to be in one of
five mutually-exclusive states:</p>
<ul style="list-style-type: upper-latin">
<li>Running
<li>Running and temporarily overriding <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a>: <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>
<li>Paused and sticky overriding <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a>: <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-running">running</a>
<li>Paused and sticky overriding <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a>: <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>
<li>Paused by <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a>
</ul>
<p>A state transition chart follows:</p>
<table class="play-state-transitions">
<tbody>
<tr>
<td rowspan="2">
<td>
<th colspan="5">Initial state
<tr>
<th>Event
<th>A
<th>B
<th>C
<th>D
<th>E
<tr>
<th class="rowgroup" rowspan="4">Resulting state
<td><code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#play">play()</a></code>
<td>A
<td>B
<td>A
<td>B
<td>B
<tr>
<td><code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#pause">pause()</a></code>
<td>C
<td>D
<td>C
<td>D
<td>D
<tr>
<td><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> → <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-running">running</a>
<td>A
<td>A
<td>C
<td>C
<td>A
<tr>
<td><a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> → <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>
<td>E
<td>B
<td>D
<td>D
<td>E
</table>
<p>If any change causes an animation to change from one of the running states (A,
B) to one of the paused states (C, D, E), the user agent must run the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#pause-an-animation">pause
an animation</a> procedure on the animation.</p>
<p>Likewise, for any change from one of the the paused states to one of the
running states, the user agent must run the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#play-an-animation">play an animation</a> procedure
on the animation. If the change is due to a change in the computed value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a> (i.e. the transition E → A) the <var>auto-rewind</var> flag for that procedure must be set to false; otherwise
it must be set to true.</p>
<h3 class="heading settled" data-level="3.2" id="animation-composition"><span class="secno">3.2. </span><span class="content">The <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-1">animation-composition</a> property</span><a class="self-link" href="#animation-composition"></a></h3>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-2">animation-composition</a> property defines the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#composite-operation">composite operation</a> used when multiple animations affect the same property simultaneously.</p>
<table class="def propdef" data-link-for-hint="animation-composition">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-type="property" data-export="" data-lt="animation-composition" id="propdef-animation-composition">animation-composition<span class="dfn-panel" data-deco=""><b><a href="#propdef-animation-composition">#propdef-animation-composition</a></b><b>Referenced in:</b><span><a href="#ref-for-propdef-animation-composition-1">3.2. The animation-composition property</a> <a href="#ref-for-propdef-animation-composition-2">(2)</a> <a href="#ref-for-propdef-animation-composition-3">(3)</a> <a href="#ref-for-propdef-animation-composition-4">(4)</a> <a href="#ref-for-propdef-animation-composition-5">(5)</a> <a href="#ref-for-propdef-animation-composition-6">(6)</a></span></span></dfn>
<tr class="value">
<th>Value:
<td class="prod"><a class="production css" data-link-type="type" href="#typedef-single-animation-composition" id="ref-for-typedef-single-animation-composition-1"><single-animation-composition></a><a data-link-type="grammar" href="https://drafts.csswg.org/css-values-3/#mult-comma">#</a>
<tr>
<th>Initial:
<td>replace
<tr>
<th>Applies to:
<td>all elements, ::before and ::after pseudo-elements
<tr>
<th>Inherited:
<td>none
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>interactive
<tr>
<th>Computed value:
<td>As specified
<tr>
<th>Animatable:
<td>no
<tr>
<th>Canonical order:
<td>per grammar
</table>
<p><dfn class="dfn-paneled css" data-dfn-type="type" data-export="" data-lt="<single-animation-composition>" id="typedef-single-animation-composition"><single-animation-composition><span class="dfn-panel" data-deco=""><b><a href="#typedef-single-animation-composition">#typedef-single-animation-composition</a></b><b>Referenced in:</b><span><a href="#ref-for-typedef-single-animation-composition-1">3.2. The animation-composition property</a></span></span></dfn> = replace | add | accumulate</p>
<p>The values of <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-3">animation-composition</a> have the meaning defined for the
corresponding values of the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#composite-operation">composite operation</a> defined in Web
Animations <a data-link-type="biblio" href="#biblio-web-animations">[WEB-ANIMATIONS]</a>.</p>
<p>When specified in a keyframe, <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-4">animation-composition</a> defines the composite
operation to use for each property specified in that keyframe until the next
keyframe specifying each property.</p>
<div class="example" id="example-e146d515">
<a class="self-link" href="#example-e146d515"></a> For example, the following stylesheet defines two different animations
targetting the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-transforms-2/#propdef-scale">scale</a> property.
<pre>@keyframes heartbeat {
from {
scale: 1;
animation-timing-function: ease-out;
}
30% {
scale: 1.3;
}
}
.heartbeat {
animation: heartbeat 0.3s 2s infinite;
}
@keyframes throb {
50% {
scale: 1.8;
}
}
.icon:mouseover {
animation: throb 0.4s add;
}
</pre>
<p>If these two animations are applied to the same element, normally only
one animation would apply, but by specifying <a class="css" data-link-type="maybe" href="https://drafts.fxtf.org/css-masking-1/#valdef-mask-composite-add">add</a> as the <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-5">animation-composition</a> on the second animation, the result of the two
animations will be combined.</p>
<p>Since CSS Transitions <a data-link-type="biblio" href="#biblio-css3-transitions">[CSS3-TRANSITIONS]</a> have a lower composite
order, it is possible to use <a class="property" data-link-type="propdesc" href="#propdef-animation-composition" id="ref-for-propdef-animation-composition-6">animation-composition</a> to combine CSS
Animations with underlying transitions as in the following example.</p>
<pre>.icon {
filter: blur(20px);
transition: filter 0.5s;
}
.icon:hover {
filter: blur(0px);
animation: brightness-pulse 3s infinite add;
}
@keyframes pulse {
0% {
scale: 1.1;
filter: brightness(130%);
}
10% {
scale: 1;
filter: brightness(100%);
}
}
</pre>
<p class="issue" id="issue-69776a9f"><a class="self-link" href="#issue-69776a9f"></a> Create pictures of these examples and verify they make sense.</p>
</div>
<h2 class="heading settled" data-level="4" id="events"><span class="secno">4. </span><span class="content">Animation Events</span><a class="self-link" href="#events"></a></h2>
<h3 class="heading settled" data-level="4.1" id="event-animationevent"><span class="secno">4.1. </span><span class="content">Types of <code>AnimationEvent</code></span><a class="self-link" href="#event-animationevent"></a></h3>
<p>The <em>additional</em> types of animation events that can occur are:</p>
<dl>
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="animationevent" data-dfn-type="event" data-export="" data-lt="animationcancel" id="eventdef-animationevent-animationcancel">animationcancel<span class="dfn-panel" data-deco=""><b><a href="#eventdef-animationevent-animationcancel">#eventdef-animationevent-animationcancel</a></b><b>Referenced in:</b><span><a href="#ref-for-eventdef-animationevent-animationcancel-1">4.1. Types of AnimationEvent</a></span><span><a href="#ref-for-eventdef-animationevent-animationcancel-2">4.2. Event dispatch</a></span></span></dfn>
<dd>
The <a data-link-type="idl" href="#eventdef-animationevent-animationcancel" id="ref-for-eventdef-animationevent-animationcancel-1">animationcancel</a> event occurs when the animation stops running in a way that does not fire an <a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationend">animationend</a> event, such as a change in the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> that removes the animation, or the animating element or one of its ancestors becoming <span class="css">display:none</span>.
<ul>
<li>Bubbles: Yes
<li>Cancelable: No
<li>Context Info: animationName, elapsedTime, pseudoElement
</ul>
</dl>
<h3 class="heading settled" data-level="4.2" id="event-dispatch"><span class="secno">4.2. </span><span class="content">Event dispatch</span><a class="self-link" href="#event-dispatch"></a></h3>
<p class="note" role="note">Note, this is a more general description of event dispatch than that of CSS
Animations Level 1 <a data-link-type="biblio" href="#biblio-css3-animations">[CSS3-ANIMATIONS]</a> since it must account for the
possibility of animations being seeked using the Web Animations API <a data-link-type="biblio" href="#biblio-web-animations">[WEB-ANIMATIONS]</a>.</p>
<p>For the purpose of determining which events to dispatch, an animation can
be considered to be in one of four mutually-exclusive <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="event state" data-noexport="" id="event-state">event states<span class="dfn-panel" data-deco=""><b><a href="#event-state">#event-state</a></b><b>Referenced in:</b><span><a href="#ref-for-event-state-1">4.2. Event dispatch</a></span></span></dfn> determined using the following procedure:</p>
<ol>
<li data-md="">
<p>If the animation is <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#idle-play-state">idle</a> or has no <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target
effect</a> it is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="idle" data-noexport="" id="idle">idle<span class="dfn-panel" data-deco=""><b><a href="#idle">#idle</a></b><b>Referenced in:</b><span><a href="#ref-for-idle-1">4.2. Event dispatch</a> <a href="#ref-for-idle-2">(2)</a></span></span></dfn>.</p>
<li data-md="">
<p>Otherwise, if the animation has a <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#current-time">current time</a> less than the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#start-delay">start delay</a> of its <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target effect</a>, or, if the animation’s <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#animation-playback-rate">playback rate</a> is less than zero and
it has a <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#current-time">current time</a> less than <em>or equal</em> to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#start-delay">start delay</a> of its <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target effect</a>, it is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="left-active" data-noexport="" id="left-active">left-active<span class="dfn-panel" data-deco=""><b><a href="#left-active">#left-active</a></b><b>Referenced in:</b><span><a href="#ref-for-left-active-1">4.2. Event dispatch</a> <a href="#ref-for-left-active-2">(2)</a> <a href="#ref-for-left-active-3">(3)</a></span></span></dfn>.</p>
<li data-md="">
<p>Otherwise, if the animation has a <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#current-time">current time</a> greater than its <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect-end">target effect end</a>, or, if the animation’s <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#animation-playback-rate">playback rate</a> is greater than or equal
to zero and it has a <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#current-time">current time</a> greater than <em>or equal</em> to
its <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect-end">target effect end</a>, it is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="right-active" data-noexport="" id="right-active">right-active<span class="dfn-panel" data-deco=""><b><a href="#right-active">#right-active</a></b><b>Referenced in:</b><span><a href="#ref-for-right-active-1">4.2. Event dispatch</a> <a href="#ref-for-right-active-2">(2)</a> <a href="#ref-for-right-active-3">(3)</a></span></span></dfn>.</p>
<li data-md="">
<p>Otherwise, it is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="active" data-noexport="" id="active">active<span class="dfn-panel" data-deco=""><b><a href="#active">#active</a></b><b>Referenced in:</b><span><a href="#ref-for-active-1">4.2. Event dispatch</a> <a href="#ref-for-active-2">(2)</a> <a href="#ref-for-active-3">(3)</a> <a href="#ref-for-active-4">(4)</a> <a href="#ref-for-active-5">(5)</a> <a href="#ref-for-active-6">(6)</a></span></span></dfn>.</p>
</ol>
<p>Each time the animation is <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#sampling">sampled</a>, the events to
dispatch are determined by comparing the <a data-link-type="dfn" href="#event-state" id="ref-for-event-state-1">event state</a> before and
after the sample as follows:</p>
<dl>
<dt data-md="">
<p>not <a data-link-type="dfn" href="#active" id="ref-for-active-1">active</a> → <a data-link-type="dfn" href="#active" id="ref-for-active-2">active</a></p>
<dd data-md="">
<p><a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationstart">animationstart</a></p>
<dt data-md="">
<p><a data-link-type="dfn" href="#left-active" id="ref-for-left-active-1">left-active</a> → <a data-link-type="dfn" href="#right-active" id="ref-for-right-active-1">right-active</a></p>
<dt data-md="">
<p><a data-link-type="dfn" href="#right-active" id="ref-for-right-active-2">right-active</a> → <a data-link-type="dfn" href="#left-active" id="ref-for-left-active-2">left-active</a></p>
<dd data-md="">
<p><a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationstart">animationstart</a>, <a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationend">animationend</a></p>
<dt data-md="">
<p><a data-link-type="dfn" href="#active" id="ref-for-active-3">active</a> → <a data-link-type="dfn" href="#left-active" id="ref-for-left-active-3">left-active</a></p>
<dt data-md="">
<p><a data-link-type="dfn" href="#active" id="ref-for-active-4">active</a> → <a data-link-type="dfn" href="#right-active" id="ref-for-right-active-3">right-active</a></p>
<dd data-md="">
<p><a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationend">animationend</a></p>
<dt data-md="">
<p><a data-link-type="dfn" href="#active" id="ref-for-active-5">active</a> → <a data-link-type="dfn" href="#active" id="ref-for-active-6">active</a></p>
<dd data-md="">
<p><a data-link-type="idl" href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationiteration">animationiteration</a> <em>if</em> there has been a change to the <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#current-iteration">current iteration</a> of the animation’s <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target effect</a>.</p>
<dt data-md="">
<p>not <a data-link-type="dfn" href="#idle" id="ref-for-idle-1">idle</a> → <a data-link-type="dfn" href="#idle" id="ref-for-idle-2">idle</a></p>
<dd data-md="">
<p><a data-link-type="idl" href="#eventdef-animationevent-animationcancel" id="ref-for-eventdef-animationevent-animationcancel-2">animationcancel</a></p>
</dl>
<p class="issue" id="issue-7ee97385"><a class="self-link" href="#issue-7ee97385"></a> Define the value of <code>elapsedTime</code> for each case.</p>
<h2 class="heading settled" data-level="5" id="interface-dom"><span class="secno">5. </span><span class="content">DOM Interfaces</span><a class="self-link" href="#interface-dom"></a></h2>
<h3 class="heading settled" data-level="5.1" id="the-CSSAnimation-interface"><span class="secno">5.1. </span><span class="content">The CSSAnimation interface</span><a class="self-link" href="#the-CSSAnimation-interface"></a></h3>
<pre class="idl def">interface <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export="" data-lt="CSSAnimation" id="cssanimation">CSSAnimation<span class="dfn-panel" data-deco=""><b><a href="#cssanimation">#cssanimation</a></b><b>Referenced in:</b><span><a href="#ref-for-cssanimation-1">2.1. Owning element</a></span><span><a href="#ref-for-cssanimation-2">2.2. Animation composite order</a> <a href="#ref-for-cssanimation-3">(2)</a></span><span><a href="#ref-for-cssanimation-4">5.1. The CSSAnimation interface</a> <a href="#ref-for-cssanimation-5">(2)</a> <a href="#ref-for-cssanimation-6">(3)</a></span><span><a href="#ref-for-cssanimation-7">5.2. Requirements on pending style changes</a> <a href="#ref-for-cssanimation-8">(2)</a></span></span></dfn> : <a data-link-type="idl-name" href="https://w3c.github.io/web-animations/#animation">Animation</a> {
readonly attribute DOMString <a class="idl-code" data-link-type="attribute" data-readonly="" data-type="DOMString " href="#dom-cssanimation-animationname" id="ref-for-dom-cssanimation-animationname-1">animationName</a>;
};
</pre>
<dl>
<dt data-md="">
<p><dfn class="dfn-paneled idl-code" data-dfn-for="CSSAnimation" data-dfn-type="attribute" data-export="" data-lt="animationName" id="dom-cssanimation-animationname">animationName<span class="dfn-panel" data-deco=""><b><a href="#dom-cssanimation-animationname">#dom-cssanimation-animationname</a></b><b>Referenced in:</b><span><a href="#ref-for-dom-cssanimation-animationname-1">5.1. The CSSAnimation interface</a></span></span></dfn>, <span> of type <a data-link-type="idl-name" href="https://heycam.github.io/webidl/#idl-DOMString">DOMString</a>, readonly</span></p>
<dd data-md="">
<p>The key used to find matching keyframes rules that define <a data-link-type="dfn" href="https://w3c.github.io/web-animations/#target-effect">target
effect</a> at the point when the animation was created.
This is the value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a> property that caused this
object to be generated or, if this object was generated using the
programming interface, the <code>animationName</code> argument
that was passed to the <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-4">CSSAnimation</a></code> constructor.</p>
</dl>
<div class="issue" id="issue-f4c0de9c">
<a class="self-link" href="#issue-f4c0de9c"></a>
<p>We need to define a constructor for <a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-5">CSSAnimation</a>.
Perhaps something like the following:</p>
<pre class="idl def">[<dfn class="idl-code" data-dfn-for="CSSAnimation" data-dfn-type="constructor" data-export="" data-lt="CSSAnimation(target, animationName, options, defaultEasing)|CSSAnimation(target, animationName, options)|CSSAnimation(target, animationName)" id="dom-cssanimation-cssanimation">Constructor<a class="self-link" href="#dom-cssanimation-cssanimation"></a></dfn> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-target">target<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-target"></a></dfn>,
DOMString <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-animationname">animationName<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-animationname"></a></dfn>,
optional (unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-options">options<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-options"></a></dfn>,
optional DOMString <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-defaulteasing">defaultEasing<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-defaulteasing"></a></dfn> = "ease"),
<dfn class="idl-code" data-dfn-for="CSSAnimation" data-dfn-type="constructor" data-export="" data-lt="CSSAnimation(target, animationName, options, defaultEasing, timeline)" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline">Constructor<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline"></a></dfn> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing, timeline)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-target">target<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-target"></a></dfn>,
DOMString <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing, timeline)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-animationname">animationName<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-animationname"></a></dfn>,
(unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing, timeline)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-options">options<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-options"></a></dfn>,
DOMString <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing, timeline)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-defaulteasing">defaultEasing<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-defaulteasing"></a></dfn>,
<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animationtimeline">AnimationTimeline</a>? <dfn class="idl-code" data-dfn-for="CSSAnimation/CSSAnimation(target, animationName, options, defaultEasing, timeline)" data-dfn-type="argument" data-export="" id="dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-timeline">timeline<a class="self-link" href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-timeline"></a></dfn>)]
partial interface <a class="idl-code" data-link-type="interface" href="#cssanimation" id="ref-for-cssanimation-6">CSSAnimation</a> { };
</pre>
<p>The difficulty is with liveness. The most useful and least magical
(but most complicated) approach is to define a subclass of <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a></code> that has the special behavior of tracking changes
to all @keyframes rules that match the supplied name and automatically
updating the set of keyframes returned by <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#getframes">getFrames()</a></code> after filling-in the default easing.</p>
<p>Something like,</p>
<pre class="idl def">[<dfn class="idl-code" data-dfn-for="CSSKeyframeEffectReadOnly" data-dfn-type="constructor" data-export="" data-lt="CSSKeyframeEffectReadOnly(keyframesName, defaultEasing)" id="dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly">Constructor<a class="self-link" href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly"></a></dfn> (DOMString <dfn class="idl-code" data-dfn-for="CSSKeyframeEffectReadOnly/CSSKeyframeEffectReadOnly(keyframesName, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-keyframesname">keyframesName<a class="self-link" href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-keyframesname"></a></dfn>, DOMString <dfn class="idl-code" data-dfn-for="CSSKeyframeEffectReadOnly/CSSKeyframeEffectReadOnly(keyframesName, defaultEasing)" data-dfn-type="argument" data-export="" id="dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-defaulteasing">defaultEasing<a class="self-link" href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-defaulteasing"></a></dfn>)]
interface <dfn class="idl-code" data-dfn-type="interface" data-export="" id="csskeyframeeffectreadonly">CSSKeyframeEffectReadOnly<a class="self-link" href="#csskeyframeeffectreadonly"></a></dfn> : <a data-link-type="idl-name" href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a> {
readonly attribute DOMString <dfn class="idl-code" data-dfn-for="CSSKeyframeEffectReadOnly" data-dfn-type="attribute" data-export="" data-readonly="" data-type="DOMString " id="dom-csskeyframeeffectreadonly-keyframesname">keyframesName<a class="self-link" href="#dom-csskeyframeeffectreadonly-keyframesname"></a></dfn>;
readonly attribute DOMString <dfn class="idl-code" data-dfn-for="CSSKeyframeEffectReadOnly" data-dfn-type="attribute" data-export="" data-readonly="" data-type="DOMString " id="dom-csskeyframeeffectreadonly-defaulteasing">defaultEasing<a class="self-link" href="#dom-csskeyframeeffectreadonly-defaulteasing"></a></dfn>;
};
</pre>
</div>
<h3 class="heading settled" data-level="5.2" id="requirements-on-pending-style-changes"><span class="secno">5.2. </span><span class="content">Requirements on pending style changes</span><a class="self-link" href="#requirements-on-pending-style-changes"></a></h3>
<p>Various operations may affect the <a data-link-type="dfn" href="https://drafts.csswg.org/css-cascade-4/#computed-value">computed values</a> of
properties on elements. User agents may, as an optimization, defer recomputing
these values until it becomes necessary.
However, all operations included in programming interface defined in this
specification, as well as those operations defined in Web Animations <a data-link-type="biblio" href="#biblio-web-animations">[WEB-ANIMATIONS]</a> that may return objects defined by this specification,
must produce a result consistent with having fully processed any such pending
changes to computed values.</p>
<div class="note" role="note">
As an example, in the following code fragment, when the specified style of <code>elem</code> is initially updated, a user agent may defer recalculating
the computed value of the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation">animation</a> property.
<p>However, the <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/web-animations/#dom-animatable-getanimations">getAnimations()</a></code> method called on <code>elem</code> is specified by Web Animations and can return <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-7">CSSAnimation</a></code> objects as
defined in this specification.
Hence, as result of the requirements in this section, the user agent must
calculate the updated value of <code>elem</code>’s <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-animations-1/#propdef-animation">animation</a> property and
create the requested <code class="idl"><a data-link-type="idl" href="#cssanimation" id="ref-for-cssanimation-8">CSSAnimation</a></code> object before returning its result.</p>
<div>
<pre class="example lang-javascript" id="example-bec75963"><a class="self-link" href="#example-bec75963"></a>elem.style.animation = 'fadeOut 1s';
elem.getAnimations()[0].pause();
</pre>
</div>
</div>
</main>
<h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
<h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
<p>Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words “MUST”,
“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification. </p>
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
<p>Examples in this specification are introduced with the words “for example”
or are set apart from the normative text with <code>class="example"</code>,
like this: </p>
<div class="example" id="example-52448c84">
<a class="self-link" href="#example-52448c84"></a>
<p>This is an example of an informative example. </p>
</div>
<p>Informative notes begin with the word “Note” and are set apart from the
normative text with <code>class="note"</code>, like this: </p>
<p class="note" role="note">Note, this is an informative note. </p>
<p>Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <code><strong class="advisement"></code>, like
this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
<h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
<p>Conformance to this specification
is defined for three conformance classes: </p>
<dl>
<dt>style sheet
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
style sheet</a>.
<dt>renderer
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
documents that use them.
<dt>authoring tool
<dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet.
</dl>
<p>A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module. </p>
<p>A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.) </p>
<p>An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module. </p>
<h3 class="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3>
<p>The following sections define several conformance requirements
for implementing CSS responsibly,
in a way that promotes interoperability in the present and future. </p>
<h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4>
<p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid
(and <a href="http://www.w3.org/TR/CSS2/conform.html#ignore">ignore as appropriate</a>)
any at-rules, properties, property values, keywords, and other syntactic constructs
for which they have no usable level of support</strong>.
In particular, user agents <em>must not</em> selectively ignore
unsupported property values and honor supported values in a single multi-value property declaration:
if any value is considered invalid (as unsupported values must be),
CSS requires that the entire declaration be ignored. </p>
<h4 class="heading settled" id="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4>
<p>To avoid clashes with future stable CSS features,
the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p>
<h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4>
<p>Once a specification reaches the Candidate Recommendation stage,
implementers should release an <a data-link-type="dfn" href="http://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation
of any CR-level feature they can demonstrate
to be correctly implemented according to spec,
and should avoid exposing a prefixed variant of that feature. </p>
<p>To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental
CSS renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before
releasing an unprefixed implementation of any CSS features. Testcases
submitted to W3C are subject to review and correction by the CSS
Working Group. </p>
<p>
Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
</p>
<h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
<h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
<ul class="index">
<li><a href="#active">active</a><span>, in §4.2</span>
<li><a href="#eventdef-animationevent-animationcancel">animationcancel</a><span>, in §4.1</span>
<li><a href="#propdef-animation-composition">animation-composition</a><span>, in §3.2</span>
<li><a href="#dom-cssanimation-animationname">animationName</a><span>, in §5.1</span>
<li><a href="#cssanimation">CSSAnimation</a><span>, in §5.1</span>
<li><a href="#dom-cssanimation-cssanimation">CSSAnimation(target, animationName)</a><span>, in §5.1</span>
<li><a href="#dom-cssanimation-cssanimation">CSSAnimation(target, animationName, options)</a><span>, in §5.1</span>
<li><a href="#dom-cssanimation-cssanimation">CSSAnimation(target, animationName, options, defaultEasing)</a><span>, in §5.1</span>
<li><a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline">CSSAnimation(target, animationName, options, defaultEasing, timeline)</a><span>, in §5.1</span>
<li><a href="#csskeyframeeffectreadonly">CSSKeyframeEffectReadOnly</a><span>, in §5.1</span>
<li><a href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly">CSSKeyframeEffectReadOnly(keyframesName, defaultEasing)</a><span>, in §5.1</span>
<li><a href="#dom-csskeyframeeffectreadonly-defaulteasing">defaultEasing</a><span>, in §5.1</span>
<li><a href="#event-state">event state</a><span>, in §4.2</span>
<li><a href="#idle">idle</a><span>, in §4.2</span>
<li><a href="#dom-csskeyframeeffectreadonly-keyframesname">keyframesName</a><span>, in §5.1</span>
<li><a href="#left-active">left-active</a><span>, in §4.2</span>
<li><a href="#owning-element">owning element</a><span>, in §2.1</span>
<li><a href="#right-active">right-active</a><span>, in §4.2</span>
<li><a href="#typedef-single-animation-composition"><single-animation-composition></a><span>, in §3.2</span>
</ul>
<h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
<ul class="index">
<li>
<a data-link-type="biblio" href="#biblio-css-animations-1">[css-animations-1]</a> defines the following terms:
<ul>
<li><a href="https://drafts.csswg.org/css-animations-1/#propdef-animation">animation</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#propdef-animation-name">animation-name</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#propdef-animation-play-state">animation-play-state</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationend">animationend</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationiteration">animationiteration</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#eventdef-animationevent-animationstart">animationstart</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-paused">paused</a>
<li><a href="https://drafts.csswg.org/css-animations-1/#valdef-animation-play-state-running">running</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-css-cascade-4">[css-cascade-4]</a> defines the following terms:
<ul>
<li><a href="https://drafts.csswg.org/css-cascade-4/#computed-value">computed value</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-css-masking-1">[css-masking-1]</a> defines the following terms:
<ul>
<li><a href="https://drafts.fxtf.org/css-masking-1/#valdef-mask-composite-add">add</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-css-transforms-2">[css-transforms-2]</a> defines the following terms:
<ul>
<li><a href="https://drafts.csswg.org/css-transforms-2/#propdef-scale">scale</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-css-values">[css-values]</a> defines the following terms:
<ul>
<li><a href="https://drafts.csswg.org/css-values-3/#mult-comma">#</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-whatwg-dom">[WHATWG-DOM]</a> defines the following terms:
<ul>
<li><a href="https://dom.spec.whatwg.org/#concept-tree-order">tree order</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-web-animations">[web-animations]</a> defines the following terms:
<ul>
<li><a href="https://w3c.github.io/web-animations/#animation">Animation</a>
<li><a href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a>
<li><a href="https://w3c.github.io/web-animations/#animation-class">animation class</a>
<li><a href="https://w3c.github.io/web-animations/#animation-playback-rate">animation playback rate</a>
<li><a href="https://w3c.github.io/web-animations/#composite-operation">composite operation</a>
<li><a href="https://w3c.github.io/web-animations/#current-iteration">current iteration</a>
<li><a href="https://w3c.github.io/web-animations/#current-time">current time</a>
<li><a href="https://w3c.github.io/web-animations/#getframes">getFrames()</a>
<li><a href="https://w3c.github.io/web-animations/#global-animation-list">global animation list</a>
<li><a href="https://w3c.github.io/web-animations/#idle-play-state">idle play state</a>
<li><a href="https://w3c.github.io/web-animations/#pause-an-animation">pause an animation</a>
<li><a href="https://w3c.github.io/web-animations/#pause">pause()</a>
<li><a href="https://w3c.github.io/web-animations/#play-an-animation">play an animation</a>
<li><a href="https://w3c.github.io/web-animations/#play">play()</a>
<li><a href="https://w3c.github.io/web-animations/#sampling">sampling</a>
<li><a href="https://w3c.github.io/web-animations/#start-delay">start delay</a>
<li><a href="https://w3c.github.io/web-animations/#target-effect">target effect</a>
<li><a href="https://w3c.github.io/web-animations/#target-effect-end">target effect end</a>
<li><a href="https://w3c.github.io/web-animations/#target-element">target element</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-web-animations-1">[web-animations-1]</a> defines the following terms:
<ul>
<li><a href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>
<li><a href="https://www.w3.org/TR/web-animations/#animationtimeline">AnimationTimeline</a>
<li><a href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>
<li><a href="https://www.w3.org/TR/web-animations/#concept-animation">animation</a>
<li><a href="https://www.w3.org/TR/web-animations/#dom-animatable-getanimations">getAnimations()</a>
</ul>
<li>
<a data-link-type="biblio" href="#biblio-webidl">[WebIDL]</a> defines the following terms:
<ul>
<li><a href="https://heycam.github.io/webidl/#idl-DOMString">DOMString</a>
</ul>
</ul>
<h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
<h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
<dl>
<dt id="biblio-css-animations-1">[CSS-ANIMATIONS-1]
<dd>CSS Animations Module Level 1 URL: <a href="https://drafts.csswg.org/css-animations-1/">https://drafts.csswg.org/css-animations-1/</a>
<dt id="biblio-css-cascade-4">[CSS-CASCADE-4]
<dd>Elika Etemad; Tab Atkins Jr.. <a href="http://dev.w3.org/csswg/css-cascade/">CSS Cascading and Inheritance Level 4</a>. 14 January 2016. CR. URL: <a href="http://dev.w3.org/csswg/css-cascade/">http://dev.w3.org/csswg/css-cascade/</a>
<dt id="biblio-css-values">[CSS-VALUES]
<dd>Tab Atkins Jr.; Elika Etemad. <a href="http://dev.w3.org/csswg/css-values/">CSS Values and Units Module Level 3</a>. 11 June 2015. CR. URL: <a href="http://dev.w3.org/csswg/css-values/">http://dev.w3.org/csswg/css-values/</a>
<dt id="biblio-css3-animations">[CSS3-ANIMATIONS]
<dd>Dean Jackson; et al. <a href="http://www.w3.org/TR/css3-animations/">CSS Animations</a>. 19 February 2013. WD. URL: <a href="http://www.w3.org/TR/css3-animations/">http://www.w3.org/TR/css3-animations/</a>
<dt id="biblio-rfc2119">[RFC2119]
<dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
<dt id="biblio-web-animations">[WEB-ANIMATIONS]
<dd>Brian Birtles; et al. <a href="http://www.w3.org/TR/web-animations-1/">Web Animations</a>. 7 July 2015. WD. URL: <a href="http://www.w3.org/TR/web-animations-1/">http://www.w3.org/TR/web-animations-1/</a>
<dt id="biblio-web-animations-1">[WEB-ANIMATIONS-1]
<dd>Brian Birtles; et al. <a href="https://w3c.github.io/web-animations/">Web Animations</a>. 7 July 2015. WD. URL: <a href="https://w3c.github.io/web-animations/">https://w3c.github.io/web-animations/</a>
<dt id="biblio-webidl">[WebIDL]
<dd>Cameron McCormack; Boris Zbarsky. <a href="https://heycam.github.io/webidl/">WebIDL Level 1</a>. 8 March 2016. CR. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
<dt id="biblio-whatwg-dom">[WHATWG-DOM]
<dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
</dl>
<h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
<dl>
<dt id="biblio-css-masking-1">[CSS-MASKING-1]
<dd>Dirk Schulze; Brian Birtles; Tab Atkins Jr.. <a href="http://www.w3.org/TR/css-masking-1/">CSS Masking Module Level 1</a>. 26 August 2014. CR. URL: <a href="http://www.w3.org/TR/css-masking-1/">http://www.w3.org/TR/css-masking-1/</a>
<dt id="biblio-css-transforms-2">[CSS-TRANSFORMS-2]
<dd>CSS Transforms Module Level 2 URL: <a href="https://drafts.csswg.org/css-transforms-2/">https://drafts.csswg.org/css-transforms-2/</a>
<dt id="biblio-css3-transitions">[CSS3-TRANSITIONS]
<dd>Dean Jackson; et al. <a href="http://www.w3.org/TR/css3-transitions/">CSS Transitions</a>. 19 November 2013. WD. URL: <a href="http://www.w3.org/TR/css3-transitions/">http://www.w3.org/TR/css3-transitions/</a>
</dl>
<h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2>
<div class="big-element-wrapper">
<table class="index">
<thead>
<tr>
<th scope="col">Name
<th scope="col">Value
<th scope="col">Initial
<th scope="col">Applies to
<th scope="col">Inh.
<th scope="col">%ages
<th scope="col">Media
<th scope="col">Animatable
<th scope="col">Canonical order
<th scope="col">Computed value
<tbody>
<tr>
<th scope="row"><a class="css" data-link-type="property" href="#propdef-animation-composition">animation-composition</a>
<td><single-animation-composition>#
<td>replace
<td>all elements, ::before and ::after pseudo-elements
<td>none
<td>N/A
<td>interactive
<td>no
<td>per grammar
<td>As specified
</table>
</div>
<h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl def">interface <a href="#cssanimation">CSSAnimation</a> : <a data-link-type="idl-name" href="https://w3c.github.io/web-animations/#animation">Animation</a> {
readonly attribute DOMString <a class="idl-code" data-link-type="attribute" data-readonly="" data-type="DOMString " href="#dom-cssanimation-animationname">animationName</a>;
};
[<a href="#dom-cssanimation-cssanimation">Constructor</a> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-target">target</a>,
DOMString <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-animationname">animationName</a>,
optional (unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-options">options</a>,
optional DOMString <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-defaulteasing">defaultEasing</a> = "ease"),
<a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline">Constructor</a> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-target">target</a>,
DOMString <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-animationname">animationName</a>,
(unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-options">options</a>,
DOMString <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-defaulteasing">defaultEasing</a>,
<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animationtimeline">AnimationTimeline</a>? <a href="#dom-cssanimation-cssanimation-target-animationname-options-defaulteasing-timeline-timeline">timeline</a>)]
partial interface <a class="idl-code" data-link-type="interface" href="#cssanimation">CSSAnimation</a> { };
[<a href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly">Constructor</a> (DOMString <a href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-keyframesname">keyframesName</a>, DOMString <a href="#dom-csskeyframeeffectreadonly-csskeyframeeffectreadonly-keyframesname-defaulteasing-defaulteasing">defaultEasing</a>)]
interface <a href="#csskeyframeeffectreadonly">CSSKeyframeEffectReadOnly</a> : <a data-link-type="idl-name" href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a> {
readonly attribute DOMString <a data-readonly="" data-type="DOMString " href="#dom-csskeyframeeffectreadonly-keyframesname">keyframesName</a>;
readonly attribute DOMString <a data-readonly="" data-type="DOMString " href="#dom-csskeyframeeffectreadonly-defaulteasing">defaultEasing</a>;
};
</pre>
<h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
<div style="counter-reset:issue">
<div class="issue"> This differs from the behavior defined for transitions. We should
probably sort transitions first, then animation, then use the global animation
list. The reason being that when developer tools etc. hang on to orphaned
animations and transitions in order to replay them, they should maintain
roughly the same composite order.<a href="#issue-ea70b453"> ↵ </a></div>
<div class="issue"> Create pictures of these examples and verify they make sense.<a href="#issue-69776a9f"> ↵ </a></div>
<div class="issue"> Define the value of <code>elapsedTime</code> for each case.<a href="#issue-7ee97385"> ↵ </a></div>
<div class="issue">
<p>We need to define a constructor for <a data-link-type="idl" href="#cssanimation">CSSAnimation</a>.
Perhaps something like the following:</p>
<pre class="idl def">[<span>Constructor</span> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <span>target</span>,
DOMString <span>animationName</span>,
optional (unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <span>options</span>,
optional DOMString <span>defaultEasing</span> = "ease"),
<span>Constructor</span> (<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animatable">Animatable</a>? <span>target</span>,
DOMString <span>animationName</span>,
(unrestricted double or <a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#dictdef-keyframeeffectoptions">KeyframeEffectOptions</a>) <span>options</span>,
DOMString <span>defaultEasing</span>,
<a data-link-type="idl-name" href="https://www.w3.org/TR/web-animations/#animationtimeline">AnimationTimeline</a>? <span>timeline</span>)]
partial interface <a class="idl-code" data-link-type="interface" href="#cssanimation">CSSAnimation</a> { };
</pre>
<p>The difficulty is with liveness. The most useful and least magical
(but most complicated) approach is to define a subclass of <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a></code> that has the special behavior of tracking changes
to all @keyframes rules that match the supplied name and automatically
updating the set of keyframes returned by <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/web-animations/#getframes">getFrames()</a></code> after filling-in the default easing.</p>
<p>Something like,</p>
<pre class="idl def">[<span>Constructor</span> (DOMString <span>keyframesName</span>, DOMString <span>defaultEasing</span>)]
interface <span>CSSKeyframeEffectReadOnly</span> : <a data-link-type="idl-name" href="https://w3c.github.io/web-animations/#keyframeeffectreadonly">KeyframeEffectReadOnly</a> {
readonly attribute DOMString <span data-readonly="" data-type="DOMString ">keyframesName</span>;
readonly attribute DOMString <span data-readonly="" data-type="DOMString ">defaultEasing</span>;
};
</pre>
<a href="#issue-f4c0de9c"> ↵ </a>
</div>
</div>
<script>
document.body.addEventListener("click", function(e) {
var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
// Find the dfn element or panel, if any, that was clicked on.
var el = e.target;
var target;
while(el.parentElement) {
if(el.tagName == "DFN") {
target = "dfn";
break;
}
if(/H\d/.test(el.tagName) && el.getAttribute('data-dfn-type') != null) {
target = "dfn";
break;
}
if(el.classList.contains("dfn-panel")) {
target = "dfn-panel";
break;
}
el = el.parentElement;
}
if(target != "dfn-panel") {
// Turn off any currently "on" or "activated" panels.
queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
el.classList.remove("on");
el.classList.remove("activated");
});
}
if(target == "dfn") {
// open the panel
var dfnPanel = el.querySelector(".dfn-panel");
if(dfnPanel) {
dfnPanel.classList.add("on");
}
} else if(target == "dfn-panel") {
// Switch it to "activated" state, which pins it.
el.classList.add("activated");
}
});
</script>