Skip to content

Commit 5d693d4

Browse files
Update procedure for determining if at a progress timeline boundary (#13819)
Update spec based on discussion in #12134. Keeping the animation in effect at a phase boundary is intended to alleviate the need for a fill mode, when the scroll range for the animation aligns with the maximum or minimum scroll position. The update aligns with the original intent of the feature.
1 parent 10488e3 commit 5d693d4

1 file changed

Lines changed: 41 additions & 44 deletions

File tree

web-animations-2/Overview.bs

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,28 @@ Add:
215215
> (e.g. scroll) timeline, the duration has a fixed upper bound. In this
216216
> case, the timeline is a <dfn lt="progress-based timeline">progress-based
217217
> timeline</dfn>, and its [=timeline duration=] is 100%.
218+
>
219+
> <dfn>minimum timeline time</dfn>
220+
>
221+
> For a [=progress-based timeline=], the minimum timeline time is the minimum
222+
> value that can be produced for the timeline. For a
223+
> [=monotonically increasing timeline=], minimum timeline time is -infinity.
224+
>
225+
> <dfn>maximum timeline time</dfn>
226+
>
227+
> For a [=progress-based timeline=], the maximum timeline time is the maximum
228+
> possible value producible for timeline time, and matches the
229+
> [=timeline duration=]. For a [=monotonically increasing timeline=]. it is
230+
> +infinity.
231+
>
232+
> Note: The minimum and maximum values will be the values associated with the
233+
> minimum and maximum scroll offsets, respectively, when using a scroll
234+
> timeline.
218235

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

221-
Update the note on the first step of the algorithm by adding the following bullet:
238+
Update the note on the first step of the algorithm by adding the following
239+
bullet:
222240

223241
> * Updating the [=animation trigger state|state=] of [=animation triggers=]
224242
> by running the [=updating animation trigger state=] procedure.
@@ -1241,55 +1259,34 @@ condition:
12411259
Add the following definitions to the list used in determining the phase of
12421260
an <a>animation effect</a>.
12431261

1244-
: <dfn>at progress timeline boundary</dfn>
1245-
:: Determined using the following procedure:
1246-
1247-
1. If <em>any</em> of the following conditions are true:
1248-
* the associated <a>animation</a>'s timeline is not a
1249-
[=progress-based timeline=], or
1250-
* the associated <a>animation</a>'s [=timeline duration=] is
1251-
unresolved or zero, or
1252-
* the <a>animation</a>'s [=playback rate=] is zero
1253-
1254-
return false
1262+
: <dfn>at timeline boundary</dfn>
1263+
:: Determined based on the first matching condition:
12551264

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

1259-
1. Set <var>unlimited current time</var> based on the first matching
1260-
condition:
1269+
:: Return true
12611270

1262-
: [=animation/start time=] is resolved:
1271+
: If the [=maximum timeline time=] matches the
1272+
[=timeline current time=]:
12631273

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

12671276
: Otherwise
12681277

1269-
:: <code>animation's [=animation/current time=]</code>
1270-
1271-
1. Let <var>effective timeline time</var> be
1272-
<code>|unlimited current time| / <a>animation</a>'s
1273-
[=playback rate=] + |effective start time|</code>
1274-
1275-
1. Let <var>effective timeline progress</var> be
1276-
<code><var>effective timeline time</var> / [=timeline duration=]</code>
1277-
1278-
1. If <var>effective timeline progress</var> is 0 or 1, return true,
1279-
otherwise false.
1280-
1281-
Issue: This procedure is not strictly correct for a paused
1282-
animation if the <a>animation</a>'s current time is explicitly set, as this can
1283-
introduce a lead or lag, between the <a>timeline</a>'s current time and
1284-
<a>animation</a>'s current time.
1285-
1286-
Issue: This procedure can likely be simplified, and instead determine if at a
1287-
scrolling boundary regardless of playback rate or start time. The surprising
1288-
behavior that this is trying to prevent is an animation becoming inactive
1289-
precisely at the scroll limit, alleviating the need for set a fill-mode with
1290-
a ScrollTimeline. Checking if timeline [=timeline/current time=] is
1291-
0 or timeline duration may be sufficient.
1278+
:: Return false
1279+
</dl>
12921280

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

12941291
Replace:
12951292

@@ -1312,7 +1309,7 @@ with:
13121309
> <em>or</em>
13131310
> 1. the <a>animation direction</a> is "backwards" and the <a>local
13141311
> time</a> is equal to the <a>before-active boundary time</a> and not
1315-
> <a>at progress timeline boundary</a>.
1312+
> <a>at timeline boundary</a>.
13161313

13171314

13181315
Replace:
@@ -1336,7 +1333,7 @@ with:
13361333
> time</a>, <em>or</em>
13371334
> 1. the <a>animation direction</a> is "forwards" and the <a>local
13381335
> time</a> is equal to the <a>active-after boundary time</a> and not
1339-
> <a>at progress timeline boundary</a>.
1336+
> <a>at timeline boundary</a>.
13401337

13411338

13421339
<h4 id="fill-modes">Fill modes</h4>

0 commit comments

Comments
 (0)