Skip to content

Commit 8df3eb2

Browse files
authored
[web-animations-1] Fixed play animation procedure for scroll animations (w3c#2075) (w3c#5059)
* Fixed play animation procedure for scroll animations. * Refactored play and pause procedures.
1 parent ba8913b commit 8df3eb2

1 file changed

Lines changed: 33 additions & 65 deletions

File tree

web-animations-1/Overview.bs

Lines changed: 33 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11401140
<var>animation</var> has a <a>pending pause task</a>, and false otherwise.
11411141
1. Let <var>has pending ready promise</var> be a boolean flag that is
11421142
initially false.
1143-
1. Let <var>performed seek</var> be a boolean flag that is initially false.
1143+
1. Let <var>seek time</var> be a <a>time value</a> that is initially <a>unresolved</a>.
11441144
1. Let <var>has finite timeline</var> be true if |animation| has an associated
11451145
<a>timeline</a> that is not [=monotonically increasing=].
11461146
1. Perform the steps corresponding to the <em>first</em> matching
@@ -1156,18 +1156,7 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11561156
* <a>current time</a> &lt; zero, or
11571157
* <a>current time</a> &ge; <a>associated effect end</a>,
11581158

1159-
:: 1. Set <var>performed seek</var> to true.
1160-
1. Update either <var>animation</var>’s <a>start time</a> or
1161-
<a>hold time</a> as follows:
1162-
1163-
<div class="switch">
1164-
1165-
: If |has finite timeline| is true,
1166-
:: Set <var>animation</var>'s <a>start time</a> to zero.
1167-
: Otherwise,
1168-
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1169-
1170-
</div>
1159+
:: Set <var>seek time</var> to zero.
11711160

11721161
: If |animation|'s [=effective playback rate=] &lt; 0,
11731162
the <var>auto-rewind</var> flag is true and <em>either</em>
@@ -1183,40 +1172,32 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
11831172
:: <a>throw</a> an "{{InvalidStateError}}" {{DOMException}} and
11841173
abort these steps.
11851174
: Otherwise,
1186-
:: 1. Set <var>performed seek</var> to true.
1187-
1. Update either <var>animation</var>’s <a>start time</a> or
1188-
<a>hold time</a> as follows:
1189-
1190-
<div class="switch">
1191-
1192-
: If |has finite timeline| is true,
1193-
:: Set <var>animation</var>'s <a>start time</a> to <a>associated
1194-
effect end</a>.
1195-
: Otherwise,
1196-
:: Set <var>animation</var>'s <a>hold time</a> to <a>associated
1197-
effect end</a>.
1198-
1199-
</div>
1175+
:: Set <var>seek time</var> to |animation|'s <a>associated effect end</a>.
12001176

12011177
</div>
12021178

12031179
: If |animation|'s [=effective playback rate=] = 0 and |animation|'s
12041180
[=current time=] is [=unresolved=],
12051181

1206-
:: 1. Set <var>performed seek</var> to true.
1207-
1. Update either <var>animation</var>’s <a>start time</a> or
1208-
<a>hold time</a> as follows:
1182+
:: Set <var>seek time</var> to zero.
1183+
1184+
</div>
12091185

1210-
<div class="switch">
1186+
1. If |seek time| is <a lt=unresolved>resolved</a>,
1187+
1188+
<div class="switch">
12111189

1212-
: If |has finite timeline| is true,
1213-
:: Set <var>animation</var>'s <a>start time</a> to zero.
1214-
: Otherwise,
1215-
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1190+
: If |has finite timeline| is true,
1191+
:: 1. Set <var>animation</var>'s <a>start time</a> to <var>seek time</var>.
1192+
1. Let |animation|'s [=hold time=] be <a>unresolved</a>.
1193+
1. [=Apply any pending playback rate=] on |animation|.
1194+
: Otherwise,
1195+
:: Set <var>animation</var>'s <a>hold time</a> to <var>seek time</var>.
12161196

1217-
</div>
1197+
</div>
12181198

1219-
</div>
1199+
1. If <var>animation</var>'s <a>hold time</a> is <a lt=unresolved>resolved</a>,
1200+
let its [=start time=] be <a>unresolved</a>.
12201201

12211202
1. If <var>animation</var> has a <a>pending play task</a> or a
12221203
<a>pending pause task</a>,
@@ -1227,15 +1208,12 @@ as CSS Animations [[CSS-ANIMATIONS-1]].
12271208
1. If the following four conditions are <em>all</em> satisfied:
12281209

12291210
* |animation|'s [=hold time=] is [=unresolved=], and
1230-
* |performed seek| is false, and
1211+
* |seek time| is [=unresolved=], and
12311212
* |aborted pause| is false, and
12321213
* |animation| does <em>not</em> have a [=pending playback rate=],
12331214

12341215
abort this procedure.
12351216

1236-
1. If <var>animation</var>'s <a>hold time</a> is <a lt=unresolved>resolved</a>,
1237-
let its [=start time=] be <a>unresolved</a>.
1238-
12391217
1. If <var>has pending ready promise</var> is false,
12401218
let <var>animation</var>'s <a>current ready promise</a> be
12411219
<a>a new promise</a> in the <a>relevant Realm</a> of <var>animation</var>.
@@ -1360,6 +1338,7 @@ follows:
13601338
1. If <var>animation</var> has a <a>pending pause task</a>, abort these steps.
13611339
1. If the <a>play state</a> of <var>animation</var> is <a
13621340
lt="paused play state">paused</a>, abort these steps.
1341+
1. Let <var>seek time</var> be a <a>time value</a> that is initially <a>unresolved</a>.
13631342
1. Let <var>has finite timeline</var> be true if |animation| has an associated
13641343
<a>timeline</a> that is not [=monotonically increasing=].
13651344
1. If the <var>animation</var>'s <a>current time</a> is <a>unresolved</a>,
@@ -1368,18 +1347,7 @@ follows:
13681347
<div class="switch">
13691348

13701349
: If <var>animation</var>'s [=playback rate=] is &ge; 0,
1371-
:: Update either <var>animation</var>’s <a>start time</a> or
1372-
<a>hold time</a> as follows:
1373-
1374-
<div class="switch">
1375-
1376-
: If |has finite timeline| is true,
1377-
:: Set <var>animation</var>'s <a>start time</a> to zero.
1378-
: Otherwise,
1379-
:: Set <var>animation</var>'s <a>hold time</a> to zero.
1380-
1381-
</div>
1382-
1350+
:: Set <var>seek time</var> to zero.
13831351
: Otherwise,
13841352
::
13851353
<div class="switch">
@@ -1389,23 +1357,23 @@ follows:
13891357
:: <a>throw</a> an "{{InvalidStateError}}" {{DOMException}}
13901358
and abort these steps.
13911359
: Otherwise,
1392-
:: Update either <var>animation</var>s <a>start time</a> or
1393-
<a>hold time</a> as follows:
1360+
:: Set <var>seek time</var> to <var>animation</var>'s <a>associated effect
1361+
end</a>.
13941362

1395-
<div class="switch">
1363+
</div>
13961364

1397-
: If |has finite timeline| is true,
1398-
:: let <var>animation</var>'s <a>start time</a> be
1399-
<a>associated effect end</a>.
1400-
: Otherwise,
1401-
:: let <var>animation</var>'s <a>hold time</a> be
1402-
<a>associated effect end</a>.
1365+
</div>
14031366

1404-
</div>
1367+
1. If |seek time| is <a lt=unresolved>resolved</a>,
14051368

1406-
</div>
1369+
<div class="switch">
14071370

1408-
</div>
1371+
: If |has finite timeline| is true,
1372+
:: Set <var>animation</var>'s <a>start time</a> to <var>seek time</var>.
1373+
: Otherwise,
1374+
:: Set <var>animation</var>'s <a>hold time</a> to <var>seek time</var>.
1375+
1376+
</div>
14091377

14101378
1. Let <var>has pending ready promise</var> be a boolean flag that is
14111379
initially false.

0 commit comments

Comments
 (0)