Skip to content

Commit e06c3a7

Browse files
authored
[web-animations-1] Swap start time position when playback rate is flipped on non-monotonic timeline (#8146)
When updating the playback rate of a non-monotonically increasing timeline we want to preserve the effective start time behavior of playing the animation. If the playback rate flips directions this requires flipping the start time to the other end of the effect. See discussion on #2075.
1 parent 75cd70f commit e06c3a7

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

web-animations-1/Overview.bs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,12 +1838,37 @@ is as follows:
18381838
[=animation/current time=] of <var>animation</var> before changing the
18391839
[=playback rate=].
18401840

1841+
1. Let <var>previous playback rate</var> be the current
1842+
[=effective playback rate=] of <var>animation</var>.
1843+
18411844
1. Set the [=playback rate=] to <var>new playback rate</var>.
18421845

1843-
1. If the <var>animation</var> is associated with a [=monotonically increasing=]
1844-
[=timeline=] and <var>previous time</var> is <a lt="unresolved">resolved</a>,
1845-
<a>set the current time</a> of <var>animation</var> to
1846-
<var>previous time</var>
1846+
1. Perform the steps corresponding to the <em>first</em> matching condition
1847+
from the following, if any:
1848+
1849+
<div class="switch">
1850+
1851+
: If <var>animation</var> is associated with a [=monotonically increasing=]
1852+
[=timeline=] and the <var>previous time</var> is <a lt="unresolved">resolved</a>,
1853+
1854+
:: <a>set the current time</a> of <var>animation</var> to
1855+
<var>previous time</var>.
1856+
1857+
: If <var>animation</var> is associated with a non-null [=timeline=]
1858+
that is not [=monotonically increasing=],
1859+
the <a>start time</a> of <var>animation</var> is <a lt=unresolved>resolved</a>,
1860+
[=associated effect end=] is not infinity, and *either*:
1861+
1862+
* the <var>previous playback rate</var> &lt; 0 and the <var>new playback rate</var> &ge; 0, or
1863+
* the <var>previous playback rate</var> &ge; 0 and the <var>new playback rate</var> &lt; 0,
1864+
1865+
:: Set <var>animation</var>'s <a>start time</a> to the result of evaluating
1866+
<code>[=associated effect end=] - [=start time=]</code> for <var>animation</var>.
1867+
1868+
Note: This effectively flips the animation start/end times on non-monotonic timelines
1869+
preserving the relative offset of the start time from the other direction.
1870+
1871+
</div>
18471872

18481873
#### Seamlessly updating the playback rate of an animation #### {#seamlessly-updating-the-playback-rate-of-an-animation}
18491874

0 commit comments

Comments
 (0)