@@ -969,6 +969,41 @@ Add the following sentence:
969969
970970</div>
971971
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+
9721007
9731008<h3 id="animation-effects">Animation effects</h3>
9741009
@@ -2390,7 +2425,7 @@ Update the attribute type for currentTime.
23902425<h3 id="the-animation-interface">The <code>Animation</code> interface</h3>
23912426
23922427Update the startTime and currentTime of the Animation interface, and add
2393- rangeStart and rangeEnd as follows:
2428+ rangeStart, rangeEnd, and progress as follows:
23942429
23952430<pre class="idl">
23962431[Exposed=Window]
@@ -2399,6 +2434,7 @@ partial interface Animation {
23992434 attribute CSSNumberish? currentTime;
24002435 attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeStart;
24012436 attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeEnd;
2437+ readonly attribute double? progress;
24022438};
24032439</pre>
24042440
@@ -2443,6 +2479,10 @@ Add:
24432479> <a href="#dom-keyframeanimationoptions-rangeend">rangeEnd</a> .
24442480> When reading the attribute, the returned value is either a
24452481> {{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=] .
24462486</div>
24472487
24482488<h3 id="the-animationeffect-interface">The <code>AnimationEffect</code> interface</h3>
0 commit comments