Skip to content

Commit 491a772

Browse files
committed
[css-animations][css-animations-2] Move animationcancel to animations level 1
1 parent f5d5826 commit 491a772

File tree

2 files changed

+53
-22
lines changed

2 files changed

+53
-22
lines changed

css-animations-2/Overview.bs

+4-16
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ urlPrefix: https://w3c.github.io/web-animations/; type: method; for: KeyframeEff
6060
urlPrefix: https://w3c.github.io/web-animations/; type: dfn; spec: web-animations
6161
text: active duration
6262
text: active phase
63+
text: active time
6364
text: after phase
6465
text: animation
6566
text: animation class
@@ -69,6 +70,7 @@ urlPrefix: https://w3c.github.io/web-animations/; type: dfn; spec: web-animation
6970
text: composite operation
7071
text: current iteration
7172
text: current time
73+
text: fill mode
7274
text: global animation list
7375
text: idle play state
7476
text: idle phase
@@ -387,21 +389,6 @@ keyframe specifying each property.
387389
388390
# Animation Events # {#events}
389391
390-
## Types of <code>AnimationEvent</code> ## {#event-animationevent}
391-
392-
The <em>additional</em> types of animation events that can occur are:
393-
394-
<dl dfn-type=event dfn-for=animationevent>
395-
<dt><dfn>animationcancel</dfn>
396-
<dd>
397-
The <a idl>animationcancel</a> event occurs when the animation stops running in a way that does not fire an <a idl>animationend</a> event, such as a change in the 'animation-name' that removes the animation, or the animating element or one of its ancestors becoming ''display:none''.
398-
<ul>
399-
<li>Bubbles: Yes</li>
400-
<li>Cancelable: No</li>
401-
<li>Context Info: animationName, elapsedTime, pseudoElement</li>
402-
</ul>
403-
</dl>
404-
405392
## Event dispatch ## {#event-dispatch}
406393
407394
Note, this is a more general description of event dispatch than that of CSS
@@ -515,7 +502,8 @@ after the sample as follows:
515502
<td>Not <a lt="idle phase">idle</a> &rarr;
516503
<a lt="idle phase">idle</a></td>
517504
<td><a idl>animationcancel</a></td>
518-
<td>0</td>
505+
<td>The <a>active time</a> of the animation at the moment it was cancelled
506+
calculated using a <a>fill mode</a> of both.</td>
519507
</tr>
520508
</tbody>
521509
</table>

css-animations/Overview.bs

+49-6
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,8 @@ Attributes</h4>
901901
<dt><dfn>elapsedTime</dfn>, of type float, readonly
902902
<dd>
903903
The amount of time the animation has been running, in seconds, when this event fired,
904-
excluding any time the animation was paused. For an ''animationstart'' event, the
905-
elapsedTime is zero unless there was a negative value for 'animation-delay', in which
906-
case the event will be fired with an elapsedTime of (-1 * delay).
904+
excluding any time the animation was paused. The precise calculation for
905+
of this member is defined along with each event type.
907906
<dt><dfn>pseudoElement</dfn>, of type <a interface>DOMString</a>, readonly
908907
<dd>
909908
The name (beginning with two colons) of the CSS pseudo-element on which the animation
@@ -924,9 +923,15 @@ Types of <code>AnimationEvent</code></h3>
924923
<dd>
925924
The <a idl>animationstart</a> event occurs at the start of the animation.
926925
If there is an 'animation-delay' then this event will fire once the delay
927-
period has expired. A negative delay will cause the event to fire with
928-
an elapsedTime equal to the absolute value of the delay; in this case the
929-
event will fire whether 'animation-play-state' is set to ''running'' or ''paused''.
926+
period has expired.
927+
<p>
928+
A negative delay will cause the event to fire with
929+
an {{AnimationEvent/elapsedTime}} equal to the absolute value of the delay
930+
capped to the <a>active duration</a> of the animation, that is,
931+
<code>min(max(-'animation-delay', 0), <a>active duration</a>)</code>; in
932+
this case the event will fire whether 'animation-play-state' is set to
933+
''running'' or ''paused''.
934+
</p>
930935
<ul>
931936
<li>Bubbles: Yes</li>
932937
<li>Cancelable: No</li>
@@ -936,6 +941,8 @@ Types of <code>AnimationEvent</code></h3>
936941
<dt><dfn>animationend</dfn>
937942
<dd>
938943
The <a idl>animationend</a> event occurs when the animation finishes.
944+
In this case the value of the {{AnimationEvent/elapsedTime}} member of
945+
the event is equal to the <a>active duration</a>.
939946
<ul>
940947
<li>Bubbles: Yes</li>
941948
<li>Cancelable: No</li>
@@ -948,6 +955,37 @@ Types of <code>AnimationEvent</code></h3>
948955
animation, except when an animationend event would fire at the same time.
949956
This means that this event does not occur for animations with an iteration
950957
count of one or less.
958+
959+
<p>The {{AnimationEvent/elapsedTime}} member in this case is equal to the
960+
product of the <var>current iteration</var> and 'animation-duration' where
961+
the <var>current iteration</var> is the zero-based index of the new
962+
iteration. For example, assuming no negative 'animation-delay', after one
963+
iteration completes the <var>current iteration</var> would be one.</p>
964+
965+
<ul>
966+
<li>Bubbles: Yes</li>
967+
<li>Cancelable: No</li>
968+
<li>Context Info: animationName, elapsedTime, pseudoElement</li>
969+
</ul>
970+
971+
<dt><dfn>animationcancel</dfn>
972+
<dd>
973+
The <a idl>animationcancel</a> event occurs when the animation stops
974+
running in a way that does not fire an <a idl>animationend</a> event, such
975+
as a change in the 'animation-name' that removes the animation, or the
976+
animating element or one of its ancestors becoming ''display:none''.
977+
978+
<p>The {{AnimationEvent/elapsedTime}} member for this event indicates
979+
the number of seconds that had elapsed since the beginning of the
980+
animation at the moment when the animation was cancelled.
981+
This excludes any time where the animation was paused. If the animation
982+
had a negative 'animation-delay', the beginning of the animation is the
983+
moment equal to the absolute value of 'animation-delay' seconds
984+
<em>prior</em> to when the animation was actually triggered.
985+
Alternatively, if the animation had a positive 'animation-delay' and the
986+
event is fired before the animation's delay has expired, the
987+
{{AnimationEvent/elapsedTime}} will be zero.</p>
988+
951989
<ul>
952990
<li>Bubbles: Yes</li>
953991
<li>Cancelable: No</li>
@@ -983,6 +1021,10 @@ objects, as <a>event handler IDL attributes</a>:
9831021
<td><dfn>onanimationend</dfn></td>
9841022
<td><dfn><a idl>animationend</a></dfn></td>
9851023
</tr>
1024+
<tr>
1025+
<td><dfn>onanimationcancel</dfn></td>
1026+
<td><dfn><a idl>animationcancel</a></dfn></td>
1027+
</tr>
9861028
</table>
9871029

9881030
<h2 id="interface-dom">
@@ -1228,6 +1270,7 @@ partial interface GlobalEventHandlers {
12281270
attribute EventHandler onanimationstart;
12291271
attribute EventHandler onanimationiteration;
12301272
attribute EventHandler onanimationend;
1273+
attribute EventHandler onanimationcancel;
12311274
};
12321275
</pre>
12331276

0 commit comments

Comments
 (0)