Skip to content

Commit 37f0682

Browse files
authored
[web-animations-1] Initialize start time of scroll animations to zero (w3c#2075) (w3c#4842)
Initialize start time of scroll animations to zero.
1 parent 44e1510 commit 37f0682

File tree

1 file changed

+106
-47
lines changed

1 file changed

+106
-47
lines changed

web-animations-1/Overview.bs

Lines changed: 106 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -828,31 +828,6 @@ follows:
828828
<var>animation</var> with the <var>did seek</var> flag set to false, and
829829
the <var>synchronously notify</var> flag set to false.
830830

831-
<h4 id="responding-to-a-newly-inactive-timeline">Responding to a newly inactive
832-
timeline</h4>
833-
834-
Issue(2080): With the set of timelines defined in this level of this
835-
specification, this situation is not expected to occur. As
836-
a result, this section will likely be moved to a subsequent level
837-
of this specification.
838-
839-
When the <a>timeline</a> associated with an <a>animation</a>,
840-
<var>animation</var>, becomes newly <a lt="inactive timeline">inactive</a>,
841-
if <var>animation</var>'s <a>previous current time</a> is <a
842-
lt="unresolved">resolved</a>, the procedure to <a>silently set the current
843-
time</a> of <var>animation</var> to <a>previous current time</a> is run.
844-
845-
<div class="note">
846-
847-
This step makes the behavior when an <a>animation</a>'s <a>timeline</a> becomes
848-
<a lt="inactive timeline">inactive</a> consistent with when it is
849-
disassociated with a <a>timeline</a>.
850-
Furthermore, it ensures that the only occasion on which an <a>animation</a>
851-
becomes <a lt="idle play state">idle</a>, is when the procedure to
852-
<a>cancel an animation</a> is performed.
853-
854-
</div>
855-
856831
<h4 id="setting-the-associated-effect" oldids="setting-the-target-effect">Setting the associated effect of an animation</h4>
857832

858833
The procedure to <dfn>set the associated effect of an animation</dfn>,
@@ -1148,6 +1123,9 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11481123
<var>animation</var> has a <a>pending pause task</a>, and false otherwise.
11491124
1. Let <var>has pending ready promise</var> be a boolean flag that is
11501125
initially false.
1126+
1. Let <var>performed seek</var> be a boolean flag that is initially false.
1127+
1. Let <var>has finite timeline</var> be true if |animation| has an associated
1128+
<a>timeline</a> that is not [=monotonically increasing=].
11511129
1. Perform the steps corresponding to the <em>first</em> matching
11521130
condition from the following, if any:
11531131

@@ -1161,23 +1139,65 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11611139
* <a>current time</a> &lt; zero, or
11621140
* <a>current time</a> &ge; <a>associated effect end</a>,
11631141

1164-
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1142+
:: 1. Set <var>performed seek</var> to true.
1143+
1. Update either <var>animation</var>’s <a>start time</a> or
1144+
<a>hold time</a> as follows:
1145+
1146+
<div class="switch">
1147+
1148+
: If |has finite timeline| is true,
1149+
:: Set <var>animation</var>'s <a>start time</a> to zero.
1150+
: Otherwise,
1151+
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1152+
1153+
</div>
1154+
11651155
: If |animation|'s [=effective playback rate=] &lt; 0,
11661156
the <var>auto-rewind</var> flag is true and <em>either</em>
11671157
<var>animation</var>'s:
11681158

11691159
* <a>current time</a> is <a>unresolved</a>, or
11701160
* <a>current time</a> &le; zero, or
11711161
* <a>current time</a> &gt; <a>associated effect end</a>,
1162+
::
1163+
<div class="switch">
1164+
1165+
: If <a>associated effect end</a> is positive infinity,
1166+
:: <a>throw</a> an "{{InvalidStateError}}" {{DOMException}} and
1167+
abort these steps.
1168+
: Otherwise,
1169+
:: 1. Set <var>performed seek</var> to true.
1170+
1. Update either <var>animation</var>’s <a>start time</a> or
1171+
<a>hold time</a> as follows:
1172+
1173+
<div class="switch">
1174+
1175+
: If |has finite timeline| is true,
1176+
:: Set <var>animation</var>'s <a>start time</a> to <a>associated
1177+
effect end</a>.
1178+
: Otherwise,
1179+
:: Set <var>animation</var>'s <a>hold time</a> to <a>associated
1180+
effect end</a>.
1181+
1182+
</div>
1183+
1184+
</div>
11721185

1173-
:: If <a>associated effect end</a> is positive infinity,
1174-
<a>throw</a> an "{{InvalidStateError}}" {{DOMException}} and
1175-
abort these steps.
1176-
Otherwise, set <var>animation</var>'s <a>hold time</a> to <a>associated
1177-
effect end</a>.
11781186
: If |animation|'s [=effective playback rate=] = 0 and |animation|'s
11791187
[=current time=] is [=unresolved=],
1180-
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1188+
1189+
:: 1. Set <var>performed seek</var> to true.
1190+
1. Update either <var>animation</var>’s <a>start time</a> or
1191+
<a>hold time</a> as follows:
1192+
1193+
<div class="switch">
1194+
1195+
: If |has finite timeline| is true,
1196+
:: Set <var>animation</var>'s <a>start time</a> to zero.
1197+
: Otherwise,
1198+
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1199+
1200+
</div>
11811201

11821202
</div>
11831203

@@ -1187,9 +1207,10 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11871207
1. Cancel that task.
11881208
1. Set <var>has pending ready promise</var> to true.
11891209

1190-
1. If the following three conditions are <em>all</em> satisfied:
1210+
1. If the following four conditions are <em>all</em> satisfied:
11911211

11921212
* |animation|'s [=hold time=] is [=unresolved=], and
1213+
* |performed seek| is false, and
11931214
* |aborted pause| is false, and
11941215
* |animation| does <em>not</em> have a [=pending playback rate=],
11951216

@@ -1322,21 +1343,50 @@ follows:
13221343
1. If <var>animation</var> has a <a>pending pause task</a>, abort these steps.
13231344
1. If the <a>play state</a> of <var>animation</var> is <a
13241345
lt="paused play state">paused</a>, abort these steps.
1346+
1. Let <var>has finite timeline</var> be true if |animation| has an associated
1347+
<a>timeline</a> that is not [=monotonically increasing=].
13251348
1. If the <var>animation</var>'s <a>current time</a> is <a>unresolved</a>,
13261349
perform the steps according to the first matching condition from below:
13271350

13281351
<div class="switch">
13291352

1330-
: If <var>animation</var>'s [=playback rate=] is &ge; 0,
1331-
:: Let <var>animation</var>'s <a>hold time</a> be zero.
1353+
: If <var>animation</var>'s [=playback rate=] is &ge; 0,
1354+
:: Update either <var>animation</var>’s <a>start time</a> or
1355+
<a>hold time</a> as follows:
1356+
1357+
<div class="switch">
1358+
1359+
: If |has finite timeline| is true,
1360+
:: Set <var>animation</var>'s <a>start time</a> to zero.
1361+
: Otherwise,
1362+
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1363+
1364+
</div>
1365+
1366+
: Otherwise,
1367+
::
1368+
<div class="switch">
1369+
1370+
: If <a>associated effect end</a> for <var>animation</var> is positive
1371+
infinity,
1372+
:: <a>throw</a> an "{{InvalidStateError}}" {{DOMException}}
1373+
and abort these steps.
1374+
: Otherwise,
1375+
:: Update either <var>animation</var>’s <a>start time</a> or
1376+
<a>hold time</a> as follows:
1377+
1378+
<div class="switch">
1379+
1380+
: If |has finite timeline| is true,
1381+
:: let <var>animation</var>'s <a>start time</a> be
1382+
<a>associated effect end</a>.
1383+
: Otherwise,
1384+
:: let <var>animation</var>'s <a>hold time</a> be
1385+
<a>associated effect end</a>.
13321386

1333-
: Otherwise,
1334-
:: If <a>associated effect end</a> for <var>animation</var> is positive
1335-
infinity,
1336-
<a>throw</a> an "{{InvalidStateError}}" {{DOMException}}
1337-
and abort these steps.
1338-
Otherwise, let <var>animation</var>'s <a>hold time</a> be
1339-
<a>associated effect end</a>.
1387+
</div>
1388+
1389+
</div>
13401390

13411391
</div>
13421392

@@ -1347,10 +1397,14 @@ follows:
13471397
1. If <var>has pending ready promise</var> is false,
13481398
set <var>animation</var>'s <a>current ready promise</a> to
13491399
<a>a new promise</a> in the <a>relevant Realm</a> of <var>animation</var>.
1350-
1. Schedule a task to be executed at the first possible moment after
1351-
the user agent has performed any processing necessary to suspend
1352-
the playback of
1353-
<var>animation</var>'s <a>associated effect</a>, if any.
1400+
1. Schedule a task to be executed at the first possible moment where
1401+
<em>both</em> of the following conditions are true:
1402+
* the user agent has performed any processing necessary to suspend
1403+
the playback of <var>animation</var>'s <a>associated effect</a>, if any.
1404+
1405+
* the animation is associated with a <a>timeline</a> that is not
1406+
<a lt="inactive timeline">inactive</a>.
1407+
13541408
The task shall perform the following steps:
13551409

13561410
1. Let <var>ready time</var> be the time value of the timeline associated
@@ -1934,11 +1988,14 @@ non-normative description is also provided:
19341988

19351989
: <a lt="idle play state">idle</a>
19361990
:: The <a>current time</a> of the animation is <a>unresolved</a> and
1991+
the <a>start time</a> of the animation is <a>unresolved</a> and
19371992
there are no pending tasks.
19381993
In this state the animation has no effect.
19391994
: <a lt="running play state">running</a>
19401995
:: The animation has a resolved <a>current time</a> that changes on each
1941-
<a>animation frame</a> (provided the [=playback rate=] is not zero).
1996+
<a>animation frame</a> (provided the [=playback rate=] is not zero
1997+
and the <a>timeline</a> is [=inactive timeline|active=] and
1998+
[=monotonically increasing=]).
19421999
: <a lt="paused play state">paused</a>
19432000
:: The animation has been suspended and the <a>current time</a>
19442001
is no longer changing.
@@ -1957,6 +2014,8 @@ condition from the following:
19572014
: <em>All</em> of the following conditions are true:
19582015
* The <a>current time</a> of <var>animation</var> is <a>unresolved</a>,
19592016
<em>and</em>
2017+
* the <a>start time</a> of <var>animation</var> is <a>unresolved</a>,
2018+
<em>and</em>
19602019
* <var>animation</var> does <em>not</em> have <em>either</em>
19612020
a <a>pending play task</a> <em>or</em> a <a>pending pause task</a>,
19622021
:: &rarr; <dfn lt="idle play state">idle</dfn>

0 commit comments

Comments
 (0)