You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specified as acomma-separated list of values. Each value can be one of the following types:
50
50
51
51
- `none`
52
-
- : The element's trigger does not have a source; it is not associated with a timeline.
52
+
- : The element's trigger does not have asource: it is not associated with any timeline and the animation does not happen.
53
53
- `auto`
54
54
- : The element's trigger source is the document's default time-based {{domxref("DocumentTimeline")}}. This is the default value.
55
55
- {{cssxref("dashed-ident")}}
56
56
- : The element creates ascroll-triggered animation trigger as a [named view progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#named_view_progress_timeline).
- : The element creates ascroll-triggered animation trigger as a [anonymous scroll progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#anonymous_scroll_progress_timelines).
- : The element creates ascroll-triggered animation trigger as a [anonymous view progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#anonymous_view_progress_timeline_the_view_function).
60
+
- : The element creates ascroll-triggered animation trigger as an [anonymous view progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#anonymous_view_progress_timeline_the_view_function).
61
61
62
62
## Description
63
63
@@ -72,7 +72,7 @@ For example:
72
72
}
73
73
```
74
74
75
-
The resulting {{domxref("ViewTimeline")}} tracks the position of the `.trigger` element across the block-axis of the nearest ancestor scroller. The trigger is activated and deactivated when the tracked element is scrolled to certain positions inside the scrollport. By default, activation occurs when the tracked element starts to enter the scrollport, and deactivation occurs when the tracked element completely exits the scrollport.
75
+
The resulting {{domxref("ViewTimeline")}} tracks the position of the `.trigger` element across the block-axis of the nearest ancestor scroller. The trigger activates and deactivates when the tracked element is scrolled to certain positions inside the scrollport. By default, activation occurs when the tracked element starts to enter the scrollport, and deactivation occurs when the tracked element completely exits the scrollport.
76
76
77
77
An animated element can be triggered by the previously described trigger by referencing its `timeline-trigger-name` in its {{cssxref("animation-trigger")}} property. The `animation-trigger` value consists of a comma-separated list, each containing the name of a trigger and one or two {{cssxref("animation-action")}} keywords that specify what the animation should do when its trigger activates and deactivates.
78
78
@@ -85,7 +85,7 @@ For example:
85
85
}
86
86
```
87
87
88
-
It is possible for the animated element and the element that creates the trigger to be the same element. In this case, the animated element creates its own trigger:
88
+
The animated element and the element that creates the trigger can be the same element. In this case, the animated element creates its own trigger:
89
89
90
90
```css
91
91
.animatedAndTrigger {
@@ -110,7 +110,7 @@ To create a triggered animation, set the `timeline-trigger-source` property to o
110
110
timeline-trigger-source: view();
111
111
```
112
112
113
-
- A [`scroll()`](/en-US/docs/Web/CSS/Reference/Properties/animation-timeline/scroll) function referencing an [anonymous scroll progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#anonymous_scroll_progress_timelines) trigger. This can be created on the root element or the nearest scroller of the element that creates the trigger. This allows you to create functionality whereby an element will start animating when it (or another element) reaches an absolute scroll offset (for example, it scrolls upwards by `600px`), and stop animating (or some other action) when it (or another element) reaches a different offset. For example:
113
+
- A [`scroll()`](/en-US/docs/Web/CSS/Reference/Properties/animation-timeline/scroll) function referencing an [anonymous scroll progress timeline](/en-US/docs/Web/CSS/Guides/Scroll-driven_animations/Timelines#anonymous_scroll_progress_timelines) trigger. You can create this on the root element or the nearest scroller of the element that creates the trigger. This allows you to create functionality whereby an element will start animating when it (or another element) reaches an absolute scroll offset (for example, it scrolls upwards by `600px`), and stop animating (or some other action) when it (or another element) reaches a different offset. For example:
114
114
115
115
```css
116
116
timeline-trigger-name: --t;
@@ -128,11 +128,11 @@ To create a triggered animation, set the `timeline-trigger-source` property to o
128
128
timeline-trigger-source: --my-timeline;
129
129
```
130
130
131
-
Scroll progress timelines are arguably not as useful for scroll-triggered animations asviewprogress timelines. You are more likely to want an animation to start at a scroll offset relative to the scrollport, not after an arbitrary amount of scrolling, where the animation may well be triggered offscreen on smaller screens.
131
+
Scroll progress timelines are arguably less useful for scroll-triggered animations thanviewprogress timelines. You are more likely to want an animation to start at a scroll offset relative to the scrollport, not after an arbitrary amount of scrolling, where the animation may well be triggered offscreen on smaller screens.
132
132
133
133
### Other values
134
134
135
-
It is also possible to set `timeline-trigger-source` to a keyword of `auto` or `none`. These both result in anon-scroll-triggered animation, but their effeects are different.
135
+
It is also possible to set `timeline-trigger-source` to a keyword of `auto` or `none`. Both result in anon-scroll-triggered animation, but their effects differ.
136
136
137
137
- The default value, `auto`, sets the element's trigger source to the document's default time-based {{domxref("DocumentTimeline")}}. This results in any animations applied to the element playing on page load.
138
138
- The `none` value results in the element's trigger having no source, which means that any animations applied to the element will not play at all.
@@ -168,7 +168,7 @@ In this example, we create a basic scroll-triggered animation that uses an anony
168
168
169
169
#### HTML
170
170
171
-
The markup contains two {{htmlelement("div")}} elements, one to animate and one on which to create a trigger, plus some basic textcontent to cause the page to scroll. The text is hidden for brevity.
171
+
The markup contains two {{htmlelement("div")}} elements: one to animate and one to create a trigger, plus basic textcontent to make the page scroll. The text is hidden for brevity.
172
172
173
173
```html
174
174
<div class="animated">I am animated</div>
@@ -291,7 +291,7 @@ Next, we define the {{cssxref("@keyframes")}} for the `rotate` animation we will
291
291
}
292
292
```
293
293
294
-
Using the `animation` shorthand, the `.animated` element has the `rotate` animation applied. Without an associated trigger, the element would start animating when the page loads. The `animation-trigger` property makes it a triggered animation. The value references a `timeline-trigger-name` of `--t` and specifies two `<animation-action>` values — `play` and `pause` — which specify that the animation will play on activation, and pause on deactivation.
294
+
Using the `animation` shorthand, the `.animated` element has the `rotate` animation applied. Without an associated trigger, the element would start animating when the page loads. The `animation-trigger` property makes it a triggered animation. The value references a `timeline-trigger-name` of `--t` and specifies two `<animation-action>` values — `play` and `pause` — which specify that the animation will play on activation and pause on deactivation.
295
295
296
296
```css live-sample___basic-view-progress-example
297
297
.animated {
@@ -320,9 +320,9 @@ Try scrolling the content up. When any part of the `.trigger` `<div>` appears in
320
320
321
321
### Basic scroll progress timeline source usage
322
322
323
-
This example is nearly identical to the previous one, except that this time we are setting the `timeline-trigger-source` to equal an anonymous scroll progress timeline instead of an anonymous view progress timeline.
323
+
This example is nearly identical to the previous one, except that this time we set `timeline-trigger-source` to an anonymous scroll progress timeline instead of an anonymous view progress timeline.
324
324
325
-
The HTML and CSS are nearly identical, except that this time we have set our `.trigger``<div>` element's `timeline-trigger-source` to [`scroll()`](/en-US/docs/Web/CSS/Reference/Properties/animation-timeline/scroll) instead of `view()`. This creates the trigger as an anonymous scroll progress timeline on the nearest scrolling ancestor of the element.
325
+
The HTML and CSS are nearly identical, except that this time we have set our `.trigger``<div>` element's `timeline-trigger-source` to [`scroll()`](/en-US/docs/Web/CSS/Reference/Properties/animation-timeline/scroll) instead of `view()`. This creates the trigger as an anonymous scroll progress timeline on the element's nearest scrolling ancestor.
326
326
327
327
We have also set a {{cssxref("timeline-trigger-activation-range")}} of `600px`, which means that the trigger will activate (meaning the animation will start playing) when the tracked element scrolls upwards by `600px`. If we didn't set this, the trigger would activate immediately on page load.
0 commit comments