@@ -142,20 +142,18 @@ Using the CSS markup:
142
142
animation-timeline: union-timeline;
143
143
}
144
144
145
- @timeline collision-timeline {
146
- timeline-type: scroll;
147
- scroll-source: selector(#container);
148
- scroll-direction: block;
149
- scroll-start: 200px;
150
- scroll-end: 300px;
145
+ @scroll-timeline collision-timeline {
146
+ source: selector(#container);
147
+ orientation: block;
148
+ start: 200px;
149
+ end: 300px;
151
150
}
152
151
153
- @timeline union-timeline {
154
- timeline-type: scroll;
155
- scroll-source: selector(#container);
156
- scroll-direction: block;
157
- scroll-start: 250px;
158
- scroll-end: 300px;
152
+ @scroll-timeline union-timeline {
153
+ source: selector(#container);
154
+ orientation: block;
155
+ start: 250px;
156
+ end: 300px;
159
157
}
160
158
161
159
@keyframes left-circle {
@@ -223,9 +221,8 @@ this example could be written as follows:
223
221
224
222
<pre class='lang-css'>
225
223
@media (prefers-reduced-motion: no-preference) {
226
- @timeline progress-timeline {
227
- timeline-type: scroll;
228
- scroll-source: selector(#body);
224
+ @scroll-timeline progress-timeline {
225
+ source: selector(#body);
229
226
}
230
227
231
228
@keyframes progress {
@@ -539,15 +536,15 @@ the following effects:
539
536
540
537
541
538
: <<timeline-name>>
542
- :: If ''@timeline'' rule with the name specified by <<timeline-name>> , then
539
+ :: If ''@scroll- timeline'' rule with the name specified by <<timeline-name>> , then
543
540
the animation's [=timeline=] is a timeline whose property values are
544
541
provided by that rule. Otherwise there is no [=timeline=] associated with
545
542
the animation.
546
543
547
544
548
545
If 'animation-timeline' property is not specified but 'animation-name' is
549
- specified then its value is used to select the timeline at-rule that provides
550
- the property values for the animation's timeline.
546
+ specified then its value is used to select the scroll- timeline at-rule that
547
+ provides the property values for the animation's timeline.
551
548
552
549
Note: Allowing animation-name to be used for selecting timeline enables most
553
550
common animations to have to use a single name for both their keyframes and
@@ -566,7 +563,7 @@ In this case, each possible value of type <<keyframes-name>> from
566
563
567
564
568
565
: <<keyframes-name>>
569
- :: If ''@timeline'' rule with the name specified by <<keyframes-name>> , then
566
+ :: If ''@scroll- timeline'' rule with the name specified by <<keyframes-name>> , then
570
567
the animation's [=timeline=] is a timeline whose property values are
571
568
provided by that rule. Otherwise the animation's [=timeline=] is a
572
569
{{DocumentTimeline}} , more specifically the <a>default document
@@ -586,106 +583,83 @@ optional <<timeline-name>>.
586
583
587
584
Issue: Update css-animations spec instead of monkey-patching it here.
588
585
589
- ## The '@timeline' at-rule ## {#timeline-at-rule}
586
+ ## The '@scroll- timeline' at-rule ## {#scroll- timeline-at-rule}
590
587
591
- [=Scroll Timelines=] are specified in CSS using the <dfn>@timeline</dfn>
588
+ [=Scroll Timelines=] are specified in CSS using the <dfn>@scroll- timeline</dfn>
592
589
at-rule, defined as follows:
593
590
594
591
<pre>
595
- @timeline = @timeline <<timeline-name>> { <<declaration-list>> }
592
+ @scroll- timeline = @scroll- timeline <<timeline-name>> { <<declaration-list>> }
596
593
597
594
598
595
<dfn><timeline-name></dfn> = <<custom-ident>> | <<string>>
599
596
</pre>
600
597
601
598
602
- An ''@timeline'' rule has a name given by the <<custom-ident>> or <<string>> in
599
+ An ''@scroll- timeline'' rule has a name given by the <<custom-ident>> or <<string>> in
603
600
its prelude. The two syntaxes are equivalent in functionality; the name is the
604
601
value of the ident or string. As normal for <<custom-ident>> s and <<string>> s,
605
602
the names are fully case-sensitive; two names are equal only if they are
606
603
codepoint-by-codepoint equal. The <<custom-ident>> additionally excludes the
607
604
none keyword.
608
605
609
606
610
- The <<declaration-list>> inside of ''@timeline'' rule can only contain the
607
+ The <<declaration-list>> inside of ''@scroll- timeline'' rule can only contain the
611
608
descriptors defined in this section.
612
609
613
- ### the 'timeline-type' descriptor ### {#timeline-type-descriptors}
614
-
615
-
616
- <pre class='descdef'>
617
- Name : timeline-type
618
- For : @timeline
619
- Value : scroll | time
620
- Initial : time
621
- </pre>
622
-
623
- The 'timeline-type' determines the type of timeline and whose possible values
624
- have the following effects:
625
-
626
- : time
627
- :: The animation's [=timeline=] is a {{DocumentTimeline}} , more specifically
628
- the <a>default document timeline</a> .
629
-
630
- : scroll
631
- :: The animation's [=timeline=] is a {{ScrollTimeline}} as specified in the
632
- ''@timeline'' rule's <<declaration-list>> .
633
-
634
-
635
-
636
610
### Scroll Timeline descriptors ### {#scroll-timeline-descriptors}
637
611
638
612
639
613
<pre class='descdef'>
640
- Name : scroll- source
641
- For : @timeline
614
+ Name : source
615
+ For : @scroll- timeline
642
616
Value : selector(<<id-selector>>) | none
643
617
Initial : none
644
618
</pre>
645
619
646
- 'scroll- source' descriptor determines the scroll timeline's {{source}} . If
647
- specified as an '<selector()>' the scroll timeline's {{source}} is the
648
- [=scroll container=] identified by the <<id-selector>> , otherwise if not
649
- specified or none then it is the the {{scrollingElement}} of the {{Document}}
650
- <a lt="document associated with a window">associated</a> with the {{Window}}
651
- that is the <a>current global object</a> .
620
+ 'source' descriptor determines the scroll timeline's {{source}} . If specified as
621
+ an '<selector()>' the scroll timeline's {{source}} is the [=scroll container=]
622
+ identified by the <<id-selector>> , otherwise if not specified or none then it is
623
+ the the {{scrollingElement}} of the {{Document}} <a lt="document associated with
624
+ a window">associated</a> with the {{Window}} that is the <a>current global
625
+ object</a> .
652
626
653
627
Issue(4338): consider choosing animation target's nearest scrollable ancestor
654
628
instead of document's scrolling Element
655
629
656
630
<pre class='descdef'>
657
- Name : scroll- orientation
658
- For : @timeline
631
+ Name : orientation
632
+ For : @scroll- timeline
659
633
Value : auto | block | inline | horizontal | vertical
660
634
Initial : auto
661
635
</pre>
662
636
663
- 'scroll- orientation' descriptor determines the scroll timeline's {{orientation}} .
637
+ 'orientation' descriptor determines the scroll timeline's {{orientation}} .
664
638
665
639
666
640
<pre class='descdef'>
667
- Name : scroll- start
668
- For : @timeline
641
+ Name : start
642
+ For : @scroll- timeline
669
643
Value : auto | <<length>> | <<percentage>>
670
644
Initial : auto
671
645
</pre>
672
646
673
- 'scroll- start' descriptor determines the scroll timeline's {{start}} .
647
+ 'start' descriptor determines the scroll timeline's {{start}} .
674
648
675
649
676
650
<pre class='descdef'>
677
- Name : scroll- end
678
- For : @timeline
651
+ Name : end
652
+ For : @scroll- timeline
679
653
Value : auto | <<length>> | <<percentage>>
680
654
Initial : auto
681
655
</pre>
682
656
683
- 'scroll- end' descriptor determines the scroll timeline's {{end}} .
657
+ 'end' descriptor determines the scroll timeline's {{end}} .
684
658
685
659
686
660
<pre class='descdef'>
687
661
Name : scroll-time-range
688
- For : @timeline
662
+ For : @scroll- timeline
689
663
Value : auto | <<time>>
690
664
Initial : auto
691
665
</pre>
@@ -736,11 +710,10 @@ instead of document's scrolling Element
736
710
<pre class="lang-css">
737
711
@media (prefers-reduced-motion: no-preference) {
738
712
739
- @timeline progress {
740
- timeline-type: scroll;
713
+ @scroll-timeline progress {
741
714
/* Assume the HTML element has id 'root' */
742
- scroll- source: selector(#root);
743
- scroll- orientation: vertical;
715
+ source: selector(#root);
716
+ orientation: vertical;
744
717
}
745
718
746
719
@keyframes progress {
@@ -758,7 +731,8 @@ instead of document's scrolling Element
758
731
width: 0;
759
732
height: 2px;
760
733
background-color: red;
761
- /* The same name is used to select keyframes and timeline at-rules */
734
+ /* This name is used to select both the keyframes and the
735
+ scroll-timeline at-rules. */
762
736
animation-name: progress;
763
737
animation-duration: 1s;
764
738
animation-fill-mode: forwards;
0 commit comments