Skip to content
77 changes: 34 additions & 43 deletions web-animations-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ Add:
> (e.g. scroll) timeline, the duration has a fixed upper bound. In this
> case, the timeline is a <dfn lt="progress-based timeline">progress-based
> timeline</dfn>, and its [=timeline duration=] is 100%.
>
> <dfn>minimum timeline time</dfn>
>
> For a scroll-timeline, the minimum timeline time is the timeline time
> associated with the minimum scroll offset. For a time-based timeline, it is
> -infinity.
Comment on lines +216 to +218

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the terms we want to use here are "progress-based" and "monotonic" rather than "scroll-timeline" and "time-based timeline". This would better align with how the rest of the spec is worded.

>
> <dfn>maximum timeline time</dfn>
>
> For a scroll-timeline, the maxiumum timeline time is the timeline time
> associated with the maximum scroll offset, and matches the
> [=timeline duration=]. For a time-based timeline, it is +infinity.
Comment on lines +222 to +224

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto about "progress-based" and "monotonic".


<h3 id="animation-frame-loop">Animation Frames</h3>

Expand Down Expand Up @@ -1232,55 +1244,34 @@ condition:
Add the following definitions to the list used in determining the phase of
an <a>animation effect</a>.

: <dfn>at progress timeline boundary</dfn>
:: Determined using the following procedure:
: <dfn>at timeline boundary</dfn>
:: Determined based on the first matching condition:

1. If <em>any</em> of the following conditions are true:
* the associated <a>animation</a>'s timeline is not a
[=progress-based timeline=], or
* the associated <a>animation</a>'s [=timeline duration=] is
unresolved or zero, or
* the <a>animation</a>'s [=playback rate=] is zero

return false

1. Let <var>effective start time</var> be the <a>animation</a>'s
[=animation/start time=] if resolved, or zero otherwise.
<dl class="switch">
: If the [=minimum timeline time=] matches the
[=timeline current time=], and playbackRate = -1:

1. Set <var>unlimited current time</var> based on the first matching
condition:
:: Return true

: [=animation/start time=] is resolved:
: If the [=maximum timeline time=] matches the
[=timeline current time=], and playbackRate = 1:

:: <code>(<var>timeline time</var> - [=animation/start time=])
&times; [=playback rate=]</code>
:: Return true

: Otherwise

:: <code>animation's [=animation/current time=]</code>

1. Let <var>effective timeline time</var> be
<code>|unlimited current time| / <a>animation</a>'s
[=playback rate=] + |effective start time|</code>

1. Let <var>effective timeline progress</var> be
<code><var>effective timeline time</var> / [=timeline duration=]</code>

1. If <var>effective timeline progress</var> is 0 or 1, return true,
otherwise false.

Issue: This procedure is not strictly correct for a paused
animation if the <a>animation</a>'s current time is explicitly set, as this can
introduce a lead or lag, between the <a>timeline</a>'s current time and
<a>animation</a>'s current time.

Issue: This procedure can likely be simplified, and instead determine if at a
scrolling boundary regardless of playback rate or start time. The surprising
behavior that this is trying to prevent is an animation becoming inactive
precisely at the scroll limit, alleviating the need for set a fill-mode with
a ScrollTimeline. Checking if timeline [=timeline/current time=] is
0 or timeline duration may be sufficient.
:: Return false
</dl>

Note: The intent of this procedure for use in phase determination is to
avoid the need for fill-mode when using a scroll-timeline where the active
timeline range spans the full scroll range, or a view-timeline where the
subject is aligned with the start or end of the source scroll container.
This algorithm is not intended to handle the general case, but rather
avoids complications, such as when a view timeline subject that is not
aligned with either bound of the scroll container being a candidate when the
magnitude of the playbackRate > 1. The algorithm also doesn't handle paused
animations. A more general solution is potentially feasible.

Replace:

Expand All @@ -1303,7 +1294,7 @@ with:
> <em>or</em>
> 1. the <a>animation direction</a> is "backwards" and the <a>local
> time</a> is equal to the <a>before-active boundary time</a> and not
> <a>at progress timeline boundary</a>.
> <a>at timeline boundary</a>.


Replace:
Expand All @@ -1327,7 +1318,7 @@ with:
> time</a>, <em>or</em>
> 1. the <a>animation direction</a> is "forwards" and the <a>local
> time</a> is equal to the <a>active-after boundary time</a> and not
> <a>at progress timeline boundary</a>.
> <a>at timeline boundary</a>.


<h4 id="fill-modes">Fill modes</h4>
Expand Down