@@ -8,8 +8,8 @@ Group: CSSWG
8
8
URL : https://drafts.csswg.org/scroll-animations-1/
9
9
ED : https://drafts.csswg.org/scroll-animations-1/
10
10
Shortname : scroll-animations-1
11
- Abstract : Defines an API and markup for creating animations that are either
12
- triggered by or tied to the scroll offset of a scroll container.
11
+ Abstract : Defines an API and markup for creating animations that are tied to
12
+ the scroll offset of a scroll container.
13
13
Editor : Brian Birtles, Invited Expert, brian@birchill.co.jp, w3cid 43194
14
14
Editor : Botond Ballo, Mozilla, botond@mozilla.com
15
15
Editor : Antoine Quint, Apple, graouts@apple.com, w3cid 51377
@@ -74,7 +74,7 @@ way that does not require script to run each time the effect is sampled. User
74
74
agents that support asynchronous scrolling are allowed (but not required) to
75
75
sample such effects asynchronously as well.
76
76
77
- ## Value Definitions {#values}
77
+ ## Value Definitions ## {#values}
78
78
79
79
This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
80
80
using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]] .
@@ -94,59 +94,8 @@ Note: Based on this <a
94
94
href="https://github.com/WICG/scroll-animations/blob/master/Use%20cases.md"> curated
95
95
list of use cases</a> .
96
96
97
- ## Scroll-triggered animations ## {#scroll-triggered-animations-usecases}
98
97
99
- ### Navigation bar shrinking effect ### {#navigation-bar-shrinking-effect}
100
-
101
- It is common to trigger an animation to run when the scroll position
102
- reaches a certain point. For example, a navigation bar may shrink once
103
- the user begins to scroll a page.
104
-
105
- <figure>
106
- <img src="img/usecase1-2.svg" width="600"
107
- alt="Use case: Shrinking navigation bar">
108
- <figcaption>
109
- Shrinking navigation bar<br>
110
- The left figure shows the navigation bar before scrolling with
111
- a large menu bar.<br>
112
- The right figure shows the shrunken navigation bar after scrolling.
113
- </figcaption>
114
- </figure>
115
-
116
- Advisement: The proposal does not yet define CSS markup or programming
117
- interfaces to express this use case.
118
-
119
- ### Navigation highlight effect ### {#navigation-highlight-effect}
120
-
121
- Similarly, it is common to trigger an animation at certain fixed points
122
- in a element's scroll range. For example, a navigation bar that changes
123
- highlight based on the reader's position within the document.
124
-
125
- <figure>
126
- <img src="img/usecase1-1.svg" width="600"
127
- alt="Use case: A navigation highlight effect.">
128
- <figcaption>
129
- A navigation highlight effect<br>
130
- On the left, the “Abstract” section is scrolled into view
131
- and hence the abstract menu item is highlighted.<br>
132
- After scrolling down to the “Background” section (right),
133
- the background menu item fades in while the abstract menu item fades
134
- out.
135
- </figcaption>
136
- </figure>
137
-
138
- Advisement: The proposal does not yet define CSS markup or programming
139
- interfaces to express this use case.
140
-
141
- ## Scroll-triggered style changes ## {#scroll-triggered-style-changes-usecase}
142
-
143
- Advisement: The proposal does not yet define CSS markup or programming
144
- interfaces to express this use case.
145
-
146
-
147
- ## Scroll-linked animations ## {#scroll-linked-animations-usecase}
148
-
149
- ### Scrollable picture-story show ### {#scrollable-animation-usecase}
98
+ ## Scrollable picture-story show ## {#scrollable-animation-usecase}
150
99
151
100
Another pattern is an animation that tells a story where the user
152
101
controls the progress of the animation by scrolling or some other
@@ -247,7 +196,7 @@ if (window.matchMedia('(prefers-reduced-motion: no-preference)').matches) {
247
196
}
248
197
</pre>
249
198
250
- ### The content progress bar # ## {#content-progress-bar-usecase}
199
+ ## The content progress bar ## {#content-progress-bar-usecase}
251
200
252
201
Another common example of an animation that tracks scroll position is a
253
202
progress bar that is used to indicate the reader's position in a long
@@ -449,7 +398,7 @@ not by wall-clock time, but by the progress of scrolling in a [=scroll container
449
398
450
399
: <dfn attribute for=ScrollTimeline>orientation</dfn>
451
400
:: Determines the direction of scrolling which triggers the activation and drives
452
- the progress of the trigger .
401
+ the progress of the timeline .
453
402
454
403
: <dfn attribute for=ScrollTimeline>start</dfn>
455
404
:: A scroll offset, in the direction specified by {{orientation}} , which constitutes
@@ -472,7 +421,7 @@ not by wall-clock time, but by the progress of scrolling in a [=scroll container
472
421
473
422
: <dfn attribute for=ScrollTimeline>end</dfn>
474
423
:: A scroll offset, in the direction specified by {{orientation}} , which constitutes
475
- the end of the range in which the trigger is activated.
424
+ the end of the range in which the timeline is activated.
476
425
477
426
Recognized values are defined by the following grammar:
478
427
@@ -856,30 +805,6 @@ run), the user agent may likewise choose not to sample scroll-driven animations
856
805
for that composited frame. In such cases, the rendered scroll offset and the
857
806
state of a scroll-driven animation may be inconsistent in the composited frame.
858
807
859
- # Scroll-triggered (but time-driven) animations # {#scroll-triggered-animations}
860
-
861
- An earlier draft of this proposal also provided for animations whose progress
862
- was driven by time (as with existing animations), but whose activation was
863
- triggered by scrolling past a certain scroll offset or into a given scroll range.
864
-
865
- The main objective was to allow triggering the animation from the compositor
866
- thread. (The objective of scroll-linked animations is to make sure that
867
- the animation is in sync with the scroll position on each composited frame.
868
- If the triggering doesn't happen on the compositor thread, then it's possible
869
- that for a few frames the visual scroll position is such that the animation
870
- should have started, but it has not in fact started yet because the main thread,
871
- which is doing the triggering, is lagging behind.)
872
-
873
- However, we found that in the vast majority of cases where a web author would
874
- want to do this, they would want to do it for a CSS transition (as opposed to
875
- a CSS animation). Unfortunately, it's not possible to trigger CSS transitions from
876
- the compositor thread (because triggering a transition requires style resolution,
877
- which cannot be performed on the compositor thread). Given the extent to which
878
- triggering complicated the API, we decided it wasn't worth it if you can't use
879
- it for transitions, so this feature was removed.
880
-
881
- The design space for triggering animations is still open. We welcome input
882
- on this subject.
883
808
884
809
<h2 id="appendix-a-considerations-for-security-and-privacy">Appendix A. Considerations for Security and Privacy</h2>
885
810
0 commit comments