@@ -1332,42 +1332,58 @@ spec: cssom-view-1; type: dfn;
1332
1332
by the {{AnimationTimeline/getCurrentTime()}} method:
1333
1333
1334
1334
<pre class="idl">
1335
+ dictionary AnimationTimeOptions {
1336
+ DOMString? range;
1337
+ };
1338
+
1335
1339
[Exposed=Window]
1336
1340
partial interface AnimationTimeline {
1337
- CSSNumericValue? getCurrentTime(optional CSSOMString rangeName );
1341
+ CSSNumericValue? getCurrentTime(optional AnimationTimeOptions options = {} );
1338
1342
};
1339
1343
</pre>
1340
1344
1341
- <div algorithm="AnimationTimeline.getCurrentTime()">
1342
- The <code> <dfn method for=AnimationTimeline>getCurrentTime(optional |rangeName|)</dfn> </code> [=method steps=] are:
1343
-
1344
- 1. If [=this=] is an [=inactive timeline=] ,
1345
- return null.
1346
-
1347
- 1. If |rangeName| is provided:
1348
-
1349
- 1. If |rangeName| is a valid [=named timeline range=] on [=this=] ,
1350
- let |progress| be the current progress through that range,
1351
- expressed as a percentage value.
1352
-
1353
- Create a [=new unit value=] from (|progress|, "percent")
1354
- and return it.
1345
+ <div class='methods'>
1355
1346
1356
- If the start and end points of the [=named timeline range=] coincide,
1357
- return negative infinity for time values before it,
1358
- positive infinity for time values after it,
1359
- and zero for time values coinciding with that point.
1360
-
1361
- 2. Otherwise, return null.
1362
-
1363
- 2. Let |current time|
1364
- be the value of [=this's=] {{AnimationTimeline/currentTime}} internal slot.
1347
+ <dt> <dfn method for=AnimationTimeline lt='getCurrentTime()'>CSSNumericValue? getCurrentTime(optional AnimationCurrentTimeOptions = {})</dfn>
1348
+ <dd>
1349
+ Returns a representation of the [=timeline/current time=]
1350
+ as follows:
1351
+
1352
+ <dl class="switch">
1353
+ <dt> If {{AnimationTimeOptions/range}} is not provided:
1354
+ <dd>
1355
+ Returns the value of {{AnimationTimeline/currentTime}} on [=this=] ,
1356
+ but representing millisecond values
1357
+ as a new {{CSSUnitValue}} in ''ms'' units
1358
+ rather than as a double.
1359
+
1360
+ <dt> If {{AnimationTimeOptions/range}} is provided
1361
+ and is a valid [=named timeline range=] on [=this=] :
1362
+ <dd>
1363
+ Let |progress| be the current progress through that range,
1364
+ expressed as a percentage value.
1365
+
1366
+ Create a [=new unit value=] from (|progress|, "percent")
1367
+ and return it.
1368
+
1369
+ If the start and end points of the [=named timeline range=] coincide,
1370
+ return negative infinity for time values before it,
1371
+ positive infinity for time values after it,
1372
+ and zero for time values coinciding with that point.
1373
+
1374
+ <dt>
1375
+ If {{AnimationTimeOptions/range}} is provided
1376
+ but is not a valid [=named timeline range=] on [=this=] :
1377
+ <dd>
1378
+ Returns null.
1379
+ </dl>
1380
+ </div>
1365
1381
1366
- If [=this=] is a {{ScrollTimeline}} ,
1367
- create a [=new unit value=] from (|current time|, "percent")
1368
- and return it.
1382
+ ISSUE(8201): This method is related to {{AnimationTimeline/currentTime}}
1383
+ but not quite the same; should it have a different name?
1369
1384
1370
- Otherwise,
1371
- create a [=new unit value=] from (|current time|, "ms")
1372
- and return it.
1373
- </div>
1385
+ ISSUE: This method returns percentages relative to a ScrollTimeline’s range
1386
+ when a range name is provided.
1387
+ But for time-based timelines, if a range name is provided,
1388
+ should it return percentage progress through that range,
1389
+ or time progress through that range?
0 commit comments