@@ -969,6 +969,41 @@ Add the following sentence:
969
969
970
970
</div>
971
971
972
+ ### Calculating the progress of an animation ### {#the-progress-of-an-animation}
973
+
974
+ An animation's <dfn export for=animation>progress</dfn> is the ratio of its
975
+ [=animation/current time=] to its [=associated effect end=] .
976
+
977
+ <div algorithm="calculate animation progress">
978
+ The [=animation/progress=] of an [=animation=] , |animation|, is calculated as follows:
979
+
980
+ <dl class=switch>
981
+
982
+ : If <em> any</em> of the following are true:
983
+ * |animation| does not have an [=animation/associated effect=] , or
984
+ * |animation|'s [=animation/current time=] is an [=unresolved=] time value,
985
+ ::
986
+ |animation|'s [=animation/progress=] is null.
987
+ : If |animation|'s [=associated effect end=] is zero,
988
+ ::
989
+ : If |animation|'s [=animation/current time=] is negative,
990
+ :: |animation|'s [=animation/progress=] is zero.
991
+
992
+ : Otherwise,
993
+ :: |animation|'s [=animation/progress=] is one.
994
+ : If |animation|'s [=associated effect end=] is infinite,
995
+ ::
996
+ |animation|'s [=animation/progress=] is zero.
997
+ : Otherwise,
998
+ ::
999
+ <blockquote>
1000
+ <code> <a for="animation">progress</a> = min(max([=animation/current time=] / |animation|'s [=associated effect end=] , 0), 1)
1001
+ </code>
1002
+ </blockquote>
1003
+
1004
+ </dl>
1005
+ </div>
1006
+
972
1007
973
1008
<h3 id="animation-effects">Animation effects</h3>
974
1009
@@ -2390,7 +2425,7 @@ Update the attribute type for currentTime.
2390
2425
<h3 id="the-animation-interface">The <code>Animation</code> interface</h3>
2391
2426
2392
2427
Update the startTime and currentTime of the Animation interface, and add
2393
- rangeStart and rangeEnd as follows:
2428
+ rangeStart, rangeEnd, and progress as follows:
2394
2429
2395
2430
<pre class="idl">
2396
2431
[Exposed=Window]
@@ -2399,6 +2434,7 @@ partial interface Animation {
2399
2434
attribute CSSNumberish? currentTime;
2400
2435
attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeStart;
2401
2436
attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeEnd;
2437
+ readonly attribute double? progress;
2402
2438
};
2403
2439
</pre>
2404
2440
@@ -2443,6 +2479,10 @@ Add:
2443
2479
> <a href="#dom-keyframeanimationoptions-rangeend">rangeEnd</a> .
2444
2480
> When reading the attribute, the returned value is either a
2445
2481
> {{TimelineRangeOffset}} or the {{DOMString}} "normal".
2482
+ >
2483
+ > : <dfn attribute for=Animation>progress</dfn>
2484
+ > :: Specifies the [=animation/progress=] of the <a>animation</a> as a proportion of its
2485
+ > [=associated effect end=] .
2446
2486
</div>
2447
2487
2448
2488
<h3 id="the-animationeffect-interface">The <code>AnimationEffect</code> interface</h3>
0 commit comments