-
Notifications
You must be signed in to change notification settings - Fork 718
[web-animation-2] Making currentTime and startTime CSSNumerish #6479
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
Merged
flackr
merged 12 commits into
w3c:main
from
kevers-google:numberish-current-and-start-time
Sep 21, 2021
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cb7a666
CSSNumberish times
ece9697
Address feedback
891e9c8
Address feedback
c469ff1
Update link
c2a5d8b
Update links
830bb4d
Fix indent errors
af88852
Cleanup indent
523a18c
Merge branch 'main' into numberish-current-and-start-time
41b828d
Fix indentation
393105f
Formatting
ee4cb3c
Fix alignment of closing tag.
1b0d12e
Move style changes to separate PR
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,11 +171,11 @@ Add: | |
> 1. If the [=iteration duration=] is auto, then perform the following steps. | ||
> * Set [=start delay=] and [=end delay=] to 0, as it is not | ||
> possible to mix time and proportions. | ||
> | ||
> | ||
> Note: Future versions may allow these properties to be assigned | ||
> percentages, at which point the delays are only to be ignored if | ||
> their values are expressed as times and not as percentages. | ||
> | ||
> | ||
> Otherwise: | ||
> 1. Let <var>total time</var> be equal to |end time| | ||
> 1. Set [=start delay=] to be the result of evaluating | ||
|
@@ -256,7 +256,7 @@ follows: | |
|
||
: If |previous play state| is 'paused': | ||
|
||
:: If |previous progress| is resolved: | ||
:: If |previous progress| is resolved: | ||
|
||
1. Set the flag |reset current time on resume| to true. | ||
1. Set [=start time=] to unresolved. | ||
|
@@ -338,6 +338,36 @@ descendant effects and custom effects such that the first condition is: | |
> effect</a> or executing any <a>custom effects</a> associated with an | ||
> <a>animation effect</a>. | ||
|
||
<h4 id='validating-a-css-numberish-time'>Validating a CSSNumberish time</h4> | ||
|
||
The procedure to <dfn>validate a CSSNumberish time</dfn> for an input | ||
value of <var>time</var> is based on the first condition that matches: | ||
|
||
<dl class="switch"> | ||
|
||
: If <em>all</em> of the following conditions are true: | ||
|
||
* The animation is associated with a [=progress-based timeline=], and | ||
* <var>time</var> is not a CSSNumeric value with percent units: | ||
|
||
:: <a>throw</a> a <span class="exceptionname">TypeError</span>. | ||
:: return false; | ||
|
||
: If <em>all</em> of the following conditions are true: | ||
|
||
* The animation is not associated with a [=progress-based timeline=], | ||
and | ||
* <var>time</var> is a CSSNumericValue, and | ||
* the units of time are not <a type lt="<time>">duration units</a>: | ||
|
||
:: <a>throw</a> a <span class="exceptionname">TypeError</span>. | ||
:: return false. | ||
|
||
: Oterwise | ||
:: return true. | ||
|
||
</dl> | ||
|
||
|
||
<h4 id='setting-the-current-time-of-an-animation'>Setting the current time of an | ||
Animation</h4> | ||
|
@@ -357,31 +387,39 @@ an animation, <var>animation</var>, to <var>seek time</var> is as follows: | |
|
||
1. Abort these steps. | ||
|
||
1. Update either <var>animation</var>'s <a>hold time</a> or | ||
[=start time=] as follows: | ||
1. Let <var>valid seek time</var> be the result of running the | ||
[=validate a CSSNumberish time=] procedure with <var>seek time</var> | ||
as the input. | ||
|
||
<dl class="switch"> | ||
1. If <var>valid seek time</var> is false, abort this procedure. | ||
|
||
: If <em>any</em> of the following conditions are true: | ||
1. Update either <var>animation</var>'s <a>hold time</a> or | ||
[=start time=] as follows: | ||
|
||
* <var>animation</var>'s <a>hold time</a> is | ||
<a lt="unresolved">resolved</a>, or | ||
* <var>animation</var>'s [=start time=] | ||
is <a lt="unresolved">unresolved</a>, or | ||
* <var>animation</var> has no associated <a>timeline</a> or the | ||
associated <a>timeline</a> is | ||
<a lt="inactive timeline">inactive</a>, or | ||
* <var>animation</var>'s [=playback rate=] is 0, | ||
<dl class="switch"> | ||
|
||
:: Set <var>animation</var>'s <a>hold time</a> to <var>seek time</var>. | ||
: If <em>any</em> of the following conditions are true: | ||
|
||
: Otherwise, | ||
:: Set <var>animation</var>'s [=start time=] to the result of evaluating | ||
<code>|timeline time| - (|seek time| / [=playback rate=])</code> | ||
where <var>timeline time</var> is the current <a>time value</a> | ||
of <a>timeline</a> associated with <var>animation</var>. | ||
* <var>animation</var>'s <a>hold time</a> is | ||
<a lt="unresolved">resolved</a>, or | ||
* <var>animation</var>'s [=start time=] | ||
is <a lt="unresolved">unresolved</a>, or | ||
* <var>animation</var> has no associated <a>timeline</a> or | ||
the associated <a>timeline</a> is | ||
<a lt="inactive timeline">inactive</a>, or | ||
* <var>animation</var>'s [=playback rate=] is 0, | ||
|
||
</dl> | ||
:: Set <var>animation</var>'s <a>hold time</a> to | ||
<var>seek time</var>. | ||
|
||
: Otherwise, | ||
:: Set <var>animation</var>'s [=start time=] to the result of | ||
evaluating | ||
<code>|timeline time| - (|seek time| / [=playback rate=])</code> | ||
where <var>timeline time</var> is the current <a>time value</a> | ||
of <a>timeline</a> associated with <var>animation</var>. | ||
|
||
</dl> | ||
|
||
1. If <var>animation</var> has no associated <a>timeline</a> or the associated | ||
<a>timeline</a> is <a lt="inactive timeline">inactive</a>, | ||
|
@@ -423,6 +461,12 @@ The procedure to <dfn>set the start time</dfn> | |
of <a>animation</a>, <var>animation</var>, to <var>new start time</var>, | ||
is as follows: | ||
|
||
1. Let <var>valid start time</var> be the result of running the | ||
[=validate a CSSNumberish time=] procedure with | ||
<var>new start time</var> as the input. | ||
|
||
1. If <var>valid start time</var> is false, abort this procedure. | ||
|
||
1. Let <var>timeline time</var> be the current <a>time value</a> of the | ||
<a>timeline</a> that <var>animation</var> is associated with. | ||
If there is no <a>timeline</a> associated with <var>animation</var> or the | ||
|
@@ -2018,6 +2062,44 @@ partial interface AnimationTimeline { | |
|
||
</div> | ||
|
||
<h3 id="the-animation-interface">The <code>Animation</code> interface</h3> | ||
|
||
Update the startTime and currentTime of the Animation interface as follows: | ||
|
||
<pre class="idl"> | ||
[Exposed=Window] | ||
partial interface Animation : EventTarget { | ||
attribute CSSNumberish? startTime; | ||
attribute CSSNumberish? currentTime; | ||
}; | ||
</pre> | ||
|
||
Replace [=start time=] and [=current time=] attribute descriptions with: | ||
|
||
<div class='attributes'> | ||
flackr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
: <dfn attribute for=Animation>startTime</dfn> | ||
:: Update the description as: | ||
|
||
> The [=start time=] of this animation. When associated with a | ||
> [=progress-based timeline=], [=start time=] must be returned as a | ||
> {{CSSNumericValue}} with percent units. Otherwise [=start time=] must be | ||
> returned as a double value, representing the time in units of | ||
> milliseconds. Setting this attribute updates the [=start time=] using the | ||
> procedure to <a>set the start time</a> of this object to the new value. | ||
|
||
: <dfn attribute for=Animation>currentTime</dfn> | ||
:: update the description as: | ||
|
||
> The <a>current time</a> of this animation. When associated with a | ||
> [=progress-based timeline=], <a>current time</a> must be returned as a | ||
> {{CSSNumericValue}}. with percent units. Otherwise <a>current time</a> | ||
> must be returned as a double value, representing the time in units of | ||
> milliseconds. Setting this attribute follows the procedure to | ||
> <a>set the current time</a> of this object to the new value. | ||
|
||
</div> | ||
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. Newline before to separate it from the block above. 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. done |
||
|
||
<h3 id="the-animationeffect-interface">The <code>AnimationEffect</code> interface</h3> | ||
|
||
<pre class='idl'> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.