-
Notifications
You must be signed in to change notification settings - Fork 716
[web-animations-2] Specify Animation progress API #9937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,6 +262,9 @@ Append: | |
> * Set [=iteration duration=] = [=intrinsic iteration duration=] | ||
> Otherwise: | ||
> * Set [=iteration duration=] = |specified iteration duration| | ||
> | ||
> An animation's <dfn export for=animation>progress</dfn> is the ratio of its | ||
> [=animation/current time=] to its associated effect's [=end time=]. | ||
|
||
### Setting the timeline of an animation ### {#setting-the-timeline} | ||
|
||
|
@@ -969,6 +972,30 @@ Add the following sentence: | |
|
||
</div> | ||
|
||
### Calculating the progress of an animation ### {#the-progress-of-an-animation} | ||
|
||
The [=animation/progress=] of an [=animation=] is calculated as follows: | ||
DavMila marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<dl class=switch> | ||
|
||
: If <em>any</em> of the following are true: | ||
* the animation does not have an [=animation/associated effect=], or | ||
* the animation's associated effect's [=end time=] is infinite, or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the thinking behind making infinite → null as opposed to zero? I think zero might be more useful overall since it represents where the animation is actually up to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* the animation's associated effect's [=end time=] is zero, or | ||
DavMila marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* the animation's [=animation/current time=] time is an [=unresolved=] time value, | ||
:: | ||
The animation's [=animation/progress=] is null. | ||
: Otherwise, | ||
:: | ||
<blockquote> | ||
<code><a for="animation">progress</a> = [=animation/current time=] / <var>effect end time</var> | ||
</code> | ||
</blockquote> | ||
|
||
Where |effect end time| is the current [=end time=] of the associated effect. | ||
DavMila marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
</dl> | ||
|
||
|
||
<h3 id="animation-effects">Animation effects</h3> | ||
|
||
|
@@ -2390,7 +2417,7 @@ Update the attribute type for currentTime. | |
<h3 id="the-animation-interface">The <code>Animation</code> interface</h3> | ||
|
||
Update the startTime and currentTime of the Animation interface, and add | ||
rangeStart and rangeEnd as follows: | ||
rangeStart, rangeEnd, and progress as follows: | ||
|
||
<pre class="idl"> | ||
[Exposed=Window] | ||
|
@@ -2399,6 +2426,7 @@ partial interface Animation { | |
attribute CSSNumberish? currentTime; | ||
attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeStart; | ||
attribute (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeEnd; | ||
readonly attribute double? progress; | ||
}; | ||
</pre> | ||
|
||
|
@@ -2443,6 +2471,10 @@ Add: | |
> <a href="#dom-keyframeanimationoptions-rangeend">rangeEnd</a>. | ||
> When reading the attribute, the returned value is either a | ||
> {{TimelineRangeOffset}} or the {{DOMString}} "normal". | ||
> | ||
> : <dfn attribute for=Animation>progress</dfn> | ||
> :: Specifies the progress of the <a>animation</a> as a proportion of its | ||
> [=animation/associated effect=]'s [=end time=]. | ||
DavMila marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
|
||
<h3 id="the-animationeffect-interface">The <code>AnimationEffect</code> interface</h3> | ||
|
Uh oh!
There was an error while loading. Please reload this page.