2929
3030 < h1 > CSS Animations Module Level 3</ h1 >
3131
32- < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 10 March 2010</ h2 >
32+ < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 23 March 2010</ h2 >
3333
3434 < dl >
3535 < dt > This version:
3636
3737 < dd > < a
38- href ="http://www.w3.org/TR/2010/ED-css3-animations-20100310 "> http://dev.w3.org/csswg/css3-animations/</ a >
39- <!--http://www.w3.org/TR/2010/WD-css3-animations-20100310 -->
38+ href ="http://www.w3.org/TR/2010/ED-css3-animations-20100323 "> http://dev.w3.org/csswg/css3-animations/</ a >
39+ <!--http://www.w3.org/TR/2010/WD-css3-animations-20100323 -->
4040
4141 < dt > Latest version:
4242
@@ -129,16 +129,12 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
129129 < ul class =toc >
130130 < li > < a href ="#introduction "> < span class =secno > 1. </ span > Introduction</ a >
131131
132- < li > < a href ="#keyframes "> < span class =secno > 2. </ span > Keyframes</ a >
133- < ul class =toc >
134- < li > < a href ="#timing-functions-for-keyframes- "> < span class =secno > 2.1.
135- </ span > Timing functions for keyframes </ a >
136- </ ul >
132+ < li > < a href ="#animations "> < span class =secno > 2. </ span > Animations</ a >
137133
138- < li > < a href ="#animations- "> < span class =secno > 3. </ span > Animations </ a >
134+ < li > < a href ="#keyframes "> < span class =secno > 3. </ span > Keyframes </ a >
139135 < ul class =toc >
140- < li > < a href ="#animation-behavior- "> < span class =secno > 3.1. </ span >
141- Animation behavior </ a >
136+ < li > < a href ="#timing-functions-for-keyframes- "> < span class =secno > 3.1.
137+ </ span > Timing functions for keyframes </ a >
142138
143139 < li > < a href ="#the-animation-name-property- "> < span class =secno > 3.2.
144140 </ span > The < span class =prop-name > ‘< code
@@ -209,23 +205,109 @@ <h2 id=introduction><span class=secno>1. </span>Introduction</h2>
209205
210206 < p > This proposal introduces < em > defined animations</ em > , in which the
211207 author can specify the changes in CSS properties over time as a set of
212- keyframes. Unlike transitions, which are triggered by changes in the
213- underlying property values, keyframe animations are triggered by the
214- application of the animation properties themselves. While the animation is
215- running, the property values in the keyframes are applied at the
216- appropriate times.
208+ keyframes. Animations are similar to transitions in that they change the
209+ presentational value of CSS properties over time. The principal difference
210+ is that while transitions trigger < i > implicitly</ i > when property values
211+ change, animations are < i > explicitly</ i > executed when the animation
212+ properties are applied. Because of this, animations require explicit
213+ values for the properties being animated. These values are specified using
214+ animation keyframes, described below.
215+
216+ < p > Many aspects of the animation can be controlled, including how many
217+ times the animation iterates, whether or not it alternates between the
218+ begin and end values, and whether or not the animation should be running
219+ or paused. An animation can also delay its start time.
220+
221+ < h2 id =animations > < span class =secno > 2. </ span > Animations</ h2 >
222+
223+ < p > CSS Animations affect computed property values. During the execution of
224+ an animation, the computed value for a property is controlled by the
225+ animation. This overrides the value specified in the normal styling
226+ system.
227+
228+ < p > In the case of multiple animations specifying behavior for the same
229+ property, the animation defined last will override the previously defined
230+ animations.
231+
232+ < p > An animation does not affect the computed value before the application
233+ of the animation, before the animation delay has expired, and after the
234+ end of the animation.
235+
236+ < div class =figure > < img alt ="" src =sandwich.png > </ div >
237+
238+ < p class =caption > Computation of animated property values
239+
240+ < p > The diagram above shows how property values are computed. The intrinsic
241+ style is shown at the top of the diagram. The computed value is derived
242+ from intrinsic style at the times when an animation is not running and
243+ also when an animation is delayed (see below for specification of
244+ animation delay). During an animation, the computed style is derived from
245+ the animated value.
246+
247+ < p > The start time of an animation is the latter of two moments: the time
248+ at which the style is resolved that specifies the animation, or the time
249+ the document's load event is fired. Therefore, an animation specified in
250+ the document stylesheet will begin at the document load. An animation
251+ specified on an element by modifying the style after the document has
252+ loaded will start when the style is resolved. That may be immediately in
253+ the case of a pseudo style rule such as hover, or may be when the
254+ scripting engine returns control to the browser (in the case of style
255+ applied by script).
256+
257+ < p > An animation applies to an element if the element has a value for < span
258+ class =prop-name > ‘< code class =property > < a
259+ href ="#animation-name "> animation-name</ a > </ code > ’</ span > that
260+ references a valid keyframes rule. Once an animation has started it
261+ continues until it ends or the < span class =prop-name > ‘< code
262+ class =property > < a
263+ href ="#animation-name "> animation-name</ a > </ code > ’</ span > is removed.
264+ The values used for the keyframes and animation properties are snapshotted
265+ at the time the animation starts. Changing them during the execution of
266+ the animation has no effect. Note also, that changing the value of < span
267+ class =prop-name > ‘< code class =property > < a
268+ href ="#animation-name "> animation-name</ a > </ code > ’</ span > does not
269+ necessarily restart an animation (e.g. if a list of animations are applied
270+ and one is removed from the list, only that animation will stop; The other
271+ animations will continue). In order to restart an animation, it must be
272+ removed then reapplied.
217273
218- < p > CSS Animations also provide greater control over the animation behavior
219- than transitions. Animation properties allow the author to control how may
220- times the animation repeats, the behavior when repeating, and to pause the
221- animation mid-cycle.
274+ < p class =note > Describe the effects of fill-mode here.
222275
223- < h2 id =keyframes > < span class =secno > 2. </ span > Keyframes</ h2 >
276+ < div class =example >
277+ < p style ="display:none "> Example(s):</ p >
224278
225- < p > In a simple transition, since both the starting value and ending value
226- are known, a single timing function and duration determine the
227- intermediate values of the animating property. If finer control of the
228- intermediate values is required, keyframes can be used.
279+ < pre >
280+ div {
281+ animation-name: diagonal-slide;
282+ animation-duration: 5s;
283+ animation-iteration-count: 10;
284+ }
285+
286+ @keyframes diagonal-slide {
287+
288+ from {
289+ left: 0;
290+ top: 0;
291+ }
292+
293+ to {
294+ left: 100px;
295+ top: 100px;
296+ }
297+
298+ }
299+
300+ </ pre >
301+ This will produce an animation that moves an element from (0, 0) to
302+ (100px, 100px) over five seconds and repeats itself nine times (for a
303+ total of ten iterations).</ div >
304+
305+ < h2 id =keyframes > < span class =secno > 3. </ span > Keyframes</ h2 >
306+
307+ < p > Keyframes are used to specify the values for the animating properties
308+ at various points during the animation. The keyframes specify the behavior
309+ of one cycle of the animation; the animation may iterate one or more
310+ times.
229311
230312 < p > Keyframes are specified using a specialized CSS at-rule. A < span
231313 class =prop-name > @keyframes</ span > rule consists of the keyword
@@ -247,22 +329,32 @@ <h2 id=keyframes><span class=secno>2. </span>Keyframes</h2>
247329 value 100%. Note that the percentage unit specifier must be used on
248330 percentage values. Therefore, "0" is an invalid keyframe selector.
249331
250- < p > Keyframes can be specified in any order. The selector determines the
251- placement of the keyframe in the animation.
332+ < p > If a 0% or "from" keyframe is not specified, then the user agent
333+ constructs a 0% keyframe using the computed values of the properties being
334+ animated. If a 100% or "to" keyframe is not specified, then the user agent
335+ constructs a 100% keyframe using the computed values of the properties
336+ being animated.
337+ <!--Every keyframe declaration must have a keyframe rule for
338+ 0% or 100%, possibly defined using "from" or "to". A keyframe
339+ declaration without these keyframe selectors is invalid and will not
340+ be available for animation. -->
341+
252342
253- < p > Every keyframe declaration must have a keyframe rule for 0% or 100%,
254- possibly defined using "from" or "to". A keyframe declaration without
255- these keyframe selectors is invalid and will not be available for
256- animation.
343+ < p class =issue > ISSUE: how does this work with repeating animations?
257344
258345 < p > The < i > keyframe declaration</ i > for a keyframe rule consists of
259346 properties and values. Properties that are unable to be animated are
260347 ignored in these rules, with the exception of < a class =prop-name
261348 href ="#animation-timing-function "> animation-timing-function'</ a > , the
262349 behavior of which is described below.
263350
351+ < p class =note > NOTE: describe what happens if a property is not present in
352+ all keyframes.
353+
264354 < p > The @keyframes rule that is used by an animation will be the last one
265- encountered in sorted rules order that matches the name of the animation.
355+ encountered in sorted rules order that matches the name of the animation
356+ specified by the < span class =prop-name > ‘< code class =property > < a
357+ href ="#animation-name "> animation-name</ a > </ code > ’</ span > property.
266358 < span class =prop-name > @keyframes</ span > rules do not cascade; therefore an
267359 animation will never derive keyframes from more than one < span
268360 class =prop-name > @keyframes</ span > rule.
@@ -278,7 +370,7 @@ <h2 id=keyframes><span class=secno>2. </span>Keyframes</h2>
278370 < p style ="display:none "> Example(s):</ p >
279371
280372 < pre >
281- @keyframes ' wobble' {
373+ @keyframes wobble {
282374
283375 0% {
284376 left: 100px;
@@ -325,7 +417,7 @@ <h2 id=keyframes><span class=secno>2. </span>Keyframes</h2>
325417 </ pre >
326418 <!-- ======================================================================================================= -->
327419
328- < h3 id =timing-functions-for-keyframes- > < span class =secno > 2 .1. </ span >
420+ < h3 id =timing-functions-for-keyframes- > < span class =secno > 3 .1. </ span >
329421 Timing functions for keyframes</ h3 >
330422
331423 < p > A keyframe style rule may also declare the timing function that is to
@@ -335,7 +427,7 @@ <h3 id=timing-functions-for-keyframes-><span class=secno>2.1. </span>
335427 < p style ="display:none "> Example(s):</ p >
336428
337429 < pre >
338- @keyframes ' bounce' {
430+ @keyframes bounce {
339431
340432 from {
341433 top: 100px;
@@ -379,105 +471,6 @@ <h3 id=timing-functions-for-keyframes-><span class=secno>2.1. </span>
379471 class =property > animation-timing-function</ code > ’</ span > property</ a >
380472 for more information.</ p >
381473 <!-- ======================================================================================================= -->
382-
383- < h2 id =animations- > < span class =secno > 3. </ span > Animations</ h2 >
384-
385- < p > Animations are similar to transitions in that they change the
386- presentational value of CSS properties over time. The principal difference
387- is that while transitions trigger < i > implicitly</ i > when property values
388- change, animations are < i > explicitly</ i > executed when the animation
389- properties are applied. Because of this, animations require explicit
390- values for the properties being animated. These values are specified using
391- animation keyframes, described above.
392-
393- < p > Many aspects of the animation can be controlled, including how many
394- times the animation iterates, whether or not it alternates between the
395- begin and end values, and whether or not the animation should be running
396- or paused. An animation can also delay its start time.
397-
398- < div class =example >
399- < p style ="display:none "> Example(s):</ p >
400-
401- < pre >
402- div {
403- animation-name: 'diagonal-slide';
404- animation-duration: 5s;
405- animation-iteration-count: 10;
406- }
407-
408- @keyframes 'diagonal-slide' {
409-
410- from {
411- left: 0;
412- top: 0;
413- }
414-
415- to {
416- left: 100px;
417- top: 100px;
418- }
419-
420- }
421-
422- </ pre >
423- This will produce an animation that moves an element from (0, 0) to
424- (100px, 100px) over five seconds and repeats itself nine times (for a
425- total of ten iterations).</ div >
426- <!-- ======================================================================================================= -->
427-
428- < h3 id =animation-behavior- > < span class =secno > 3.1. </ span > Animation
429- behavior</ h3 >
430-
431- < p > CSS Animations affect computed property values. During the execution of
432- an animation, the computed value for a property is controlled by the
433- animation. This overrides the value specified in the normal styling
434- system.
435-
436- < p > In the case of multiple animations specifying behavior for the same
437- property, the animation defined last will override the previously defined
438- animations.
439-
440- < p > An animation does not affect the computed value before the application
441- of the animation, before the animation delay has expired, and after the
442- end of the animation.
443-
444- < div class =figure > < img alt ="" src =sandwich.png > </ div >
445-
446- < p class =caption > Computation of animated property values
447-
448- < p > The diagram above shows how property values are computed. The intrinsic
449- style is shown at the top of the diagram. The computed value is derived
450- from intrinsic style at the times when an animation is not running and
451- also when an animation is delayed (see below for specification of
452- animation delay). During an animation, the computed style is derived from
453- the animated value.
454-
455- < p > The start time of an animation is the latter of two moments: the time
456- at which the style is resolved that specifies the animation, or the time
457- the document's load event is fired. Therefore, an animation specified in
458- the document stylesheet will begin at the document load. An animation
459- specified on an element by modifying the style after the document has
460- loaded will start when the style is resolved. That may be immediately in
461- the case of a pseudo style rule such as hover, or may be when the
462- scripting engine returns control to the browser (in the case of style
463- applied by script).
464-
465- < p > An animation applies to an element if the element has a value for < span
466- class =prop-name > ‘< code class =property > < a
467- href ="#animation-name "> animation-name</ a > </ code > ’</ span > that
468- references a valid keyframes rule. Once an animation has started it
469- continues until it ends or the < span class =prop-name > ‘< code
470- class =property > < a
471- href ="#animation-name "> animation-name</ a > </ code > ’</ span > is removed.
472- The values used for the keyframes and animation properties are snapshotted
473- at the time the animation starts. Changing them during the execution of
474- the animation has no effect. Note also, that changing the value of < span
475- class =prop-name > ‘< code class =property > < a
476- href ="#animation-name "> animation-name</ a > </ code > ’</ span > does not
477- necessarily restart an animation (e.g. if a list of animations are applied
478- and one is removed from the list, only that animation will stop; The other
479- animations will continue). In order to restart an animation, it must be
480- removed then reapplied.</ p >
481474 <!-- ======================================================================================================= -->
482475
483476 < h3 id =the-animation-name-property- > < span class =secno > 3.2. </ span > The
0 commit comments