8000 [scroll-animations-1][web-animations-2] Deferred start time by kevers-google · Pull Request #9181 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions scroll-animations-1/Overview.bs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<style>
/* crbug.com/1471465 */
dl.switch > dt {
counter-increment: list-item 0;
}
</style>
<pre class='metadata'>
Title: Scroll-driven Animations
Group: CSSWG
Expand Down Expand Up @@ -25,26 +31,37 @@ Markup Shorthands: markdown yes
<pre class=anchors>
urlPrefix: https://html.spec.whatwg.org/multipage/window-object.html; type: dfn; spec: html
text: document associated with a window; url: concept-document-window
urlPrefix: https://drafts.csswg.org/web-animations-2/; type: dfn; spec: web-animations-2
text: calculating an auto-aligned start time
</pre>
<pre class=link-defaults>
spec:web-animations-1;
type:interface; text:AnimationTimeline
type:attribute; text:currentTime
type:dfn;
text:current time
text:start time
text:active interval
text:start delay
text:end delay
text:active duration
text:iteration count
text:iteration duration
text:finished play state
text:play state
text:effective playback rate
text:effect value
spec:html;
type:dfn; for:/; text:browsing context
type:method; text:requestAnimationFrame()
spec: cssom-view-1; type: dfn;
text: overflow direction;
text: css layout box
spec:css-writing-modes-4; type: dfn;
text:start
text:end
spec:infra; type:dfn; text:user agent
spec:selectors-4; type:dfn; text:selector
</pre>

# Introduction # {#intro}
Expand Down Expand Up @@ -89,7 +106,7 @@ spec: cssom-view-1; type: dfn;
to CSS Animations [[CSS-ANIMATIONS-1]].
To the extent the behavior of these CSS properties is described
in terms of the programming interfaces,
[=User Agents=] that do not support scripting
[=user agent|User Agents=] that do not support scripting
may still conform to this specification
by implementing the CSS features to behave
as if the underlying programming interfaces were in place.
Expand Down Expand Up @@ -145,9 +162,9 @@ spec: cssom-view-1; type: dfn;

Progress (the [=timeline/current time=]) for a [=scroll progress timeline=]
is calculated as:
<var>[=scroll offset=]</var> &div;
(<var>[=scrollable overflow=] size</var> &minus;
<var>[=scroll container=] size</var>)
<var ignore=''>[=scroll offset=]</var> &div;
(<var ignore=''>[=scrollable overflow=] size</var> &minus;
<var ignore=''>[=scroll container=] size</var>)

If the 0% position and 100% position coincide
(i.e. the denominator in the [=timeline/current time=] formula is zero),
Expand Down Expand Up @@ -630,7 +647,7 @@ spec: cssom-view-1; type: dfn;
to the {{ViewTimeline/subject}}’s
nearest ancestor [=scroll container=] element.

1. If a {{DOMString}} value is provided as an |inset|,
1. If a {{DOMString}} value is provided as an inset,
parse it as a <<'view-timeline-inset'>> value;
if a sequence is provided,
the first value represents the start inset
Expand Down Expand Up @@ -768,8 +785,8 @@ spec: cssom-view-1; type: dfn;
to a finite [=attachment range=]--
which may be further limited by 'animation-range'
(see [[#timeline-ranges]]).
The animation’s <!-- delays ('animation-delay')
and --> iterations ('animation-iteration-count')
The animation’s <!-- delays ('animation-delay') and -->
iterations ('animation-iteration-count')
are set within the limits of this finite range.
If the specified duration is ''animation-duration/auto'',
then <!-- once any delays are subtracted, -->
Expand Down Expand Up @@ -874,12 +891,12 @@ spec: cssom-view-1; type: dfn;
and the <code>animationend</code> event will fire
at the start of the [=active interval=].
However, since the <code>finish</code> event
is about entering the [=finished play state=],
is about entering the [=play state/finished|finished play state=],
it only fires when scrolling forwards.

# Frame Calculation Details # {#frames}

## HTML Processing Model: Event loop
## HTML Processing Model: Event loop ## {#html-processing-model-event-loop}

The ability for scrolling to drive the progress of an animation,
gives rise to the possibility of <dfn>layout cycles</dfn>,
Expand All @@ -896,8 +913,7 @@ spec: cssom-view-1; type: dfn;
After step 7.14 if any timelines' [=named timeline ranges=] have changed,
these timelines are added to the [=stale timelines=] set.
If there are any [=stale timelines=], they now update their current time and associated ranges,
the set of [=stale timelines=] is cleared and
we run and we run an additional step to recalculate styles and update layout.
the set of [=stale timelines=] is cleared and we run an additional step to recalculate styles and update layout.

Note: We check for layout changes after dispatching any {{ResizeObserver}}s intentionally
to take programmatically sized elements into account.
Expand All @@ -908,7 +924,7 @@ spec: cssom-view-1; type: dfn;
and be updated at the same time.

Note: Without this additional round of style and layout,
[=initially stale=] timelines would remain stale
[=stale timelines|initially stale=] timelines would remain stale
(i.e. they would not have a current time)
for the remainder of the frame where the timeline was created.
This means that animations linked to such a timeline
Expand All @@ -918,8 +934,7 @@ spec: cssom-view-1; type: dfn;

Note: This section has no effect on forced style and layout
calculations triggered by {{Window/getComputedStyle()|getComputedStyle()}} or similar.
In other words, [=initially stale=] timelines are visible as such
through those APIs.
In other words, [=stale timelines|initially stale=] timelines are visible as such through those APIs.

If the final style and layout update
would result in a change in the time or scope (see 'timeline-scope')
Expand All @@ 8000 -938,13 +953,18 @@ spec: cssom-view-1; type: dfn;
and the state of a scroll-driven animation
may be inconsistent in the composited frame.

# Privacy Considerations
When updating timeline current time,
the [=start time=] of any attached animation is conditionally updated.
For each attached animation,
run the procedure for [=calculating an auto-aligned start time=].

There are no known privacy impacts of the features in this specification.
# Privacy Considerations # {#privacy-considerations}

# Security Considerations
There are no known privacy impacts of the features in this specification.

There are no known security impacts of the features in this specification.
# Security Considerations # {#security-considerations}

There are no known security impacts of the features in this specification.

# Appendix A: Timeline Ranges # {#timeline-ranges}

Expand Down
6 changes: 3 additions & 3 deletions web-animations-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ Waiting for the associated effect</h4>

Initially the [=pending playback rate=] of an [=animation=] is unset.

The <dfn>effective playback rate</dfn> of an [=animation=] is
The <dfn export>effective playback rate</dfn> of an [=animation=] is
its [=pending playback rate=], if set,
otherwise it is the animation's [=playback rate=].

Expand Down Expand Up @@ -2536,7 +2536,7 @@ Animation effects {#animation-effects}

</div>

[=Animation effects=] define an <dfn>active interval</dfn>
[=Animation effects=] define an <dfn export>active interval</dfn>
which is the period of time during which the effect
is scheduled to produce its effect--
with the exception of [=fill modes=],
Expand Down Expand Up @@ -3226,7 +3226,7 @@ Core animation effect calculations {#core-animation-effect-calculations}
The [=active duration=] is calculated as follows:

<blockquote>
<dfn>active duration</dfn> =
<dfn export>active duration</dfn> =
<code><a>iteration duration</a> × <a>iteration count</a></code>
</blockquote>

Expand Down
Loading
0