W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: [css3-animations] Clarifying the handling of repeated animation names

From: Øyvind Stenhaug <oyvinds@opera.com>
Date: Tue, 15 Jan 2013 19:08:33 +0100
To: "www-style@w3.org" <www-style@w3.org>, "Sylvain Galineau" <sylvaing@microsoft.com>
Cc: "L. David Baron (dbaron@dbaron.org)" <dbaron@dbaron.org>
Message-ID: <op.wqysojxmbunlto@oyvinds-desktop>
On Mon, 14 Jan 2013 22:56:40 +0100, Sylvain Galineau  
<sylvaing@microsoft.com> wrote:

>
> [Øyvind Stenhaug:]
>>
>> On Fri, 11 Jan 2013 19:54:23 +0100, Sylvain Galineau
>> <sylvaing@microsoft.com> wrote:

>> > 1. If the animation shorthand runs multiple animations against the
>> > same property, use 'last one wins' to decide which @keyframes rule
>> > animates that property. Then only allow this one animation to update
>> > the property *regardless of the respective durations of the
>> > winning/losing animations*.
>> >
>> > 2. If the animation shorthand runs multiple animations against the
>> > same property, use 'last one wins' to decide which @keyframes rule
>> > animates the property *first*. Once this animation has completed, use
>> > last-one-wins to pick the next @keyframes rule to animate the property
>> > *among the losing animations that are still running*.

>> > While #1 is much simpler, I'm not sure this reflects author intent  
>> well.
>> > It may
>> > not even reflect the spec's original intent either; the first prose
>> > excerpt above specifically says the last animation wins *at that point
>> > in time*.
>>
>> For what it's worth, that wording is not the *original* one (it was
>> changed for <https://www.w3.org/Bugs/Public/show_bug.cgi?id=14778>).
>
> Yes; I really meant 'the original intent of the current prose'; but since
> you wrote it I'm comfortable taking your word as to what it meant :)

OK, #1 does indeed not reflect the original intent of the current prose  
(which I probably wrote with the Gecko/WebKit in mind) :)

>> Though B) might require clarifying what
>> happens if 'animation-name' is changed. For instance, what happens if  
>> you
>> go from 'foo 10s foo 20s' to 'foo 30s' and then to 'foo 10s foo 20s'
>> again? Does the 20-second 'foo' get restarted? ("In order to restart an
>> animation, it must be removed then reapplied.")

Oops, I forgot commas after the '10s' here.

> I'm not sure I follow this  
> point?http://lists.w3.org/Archives/Public/www-style/2011Apr/0352.html

In short: When you go from "animation-name: foo, foo" to "animation-name:  
foo", does that correspond to removing the first "foo", or the last?

In long: I'm thinking of the part of  
http://dev.w3.org/csswg/css3-animations/#animations a couple of paragraphs  
above the example. A more complete quote:

"Note also that changing the value of ‘animation-name’ does not  
necessarily restart an animation (e.g., if a list of animations are  
applied and one is removed from the list, only that animation will stop;  
The other animations will continue). In order to restart an animation, it  
must be removed then reapplied."

For a simpler example[*], let's say we have

<!doctype html>
<style>
@keyframes foo { from { margin-left: 0px; } to { margin-left: 600px; } }
@keyframes bar { from { margin-left: 0px; } to { margin-left: 600px; } }
p { animation-duration: 10s; animation-name: foo; }
.first { animation-name: foo, bar; }
.second { animation-name: bar, foo; }
</style>
<p>Moving right</p>

At t=5 seconds, we change the class name of the <p>. If we set it to  
"first", then there is a new animation that is "winning" and it starts  
 from the beginning, reaching 100% at t=15 seconds.

On the other hand, if we set the class to "second" instead, then "foo" is  
still winning so it just carries on and reaches 100% at t=10 seconds.  
(Then, assuming alternative #2, "bar" takes over and does the last half of  
the animation all over again.)

So if all instances of 'bar' in this example is replaced by 'foo', which  
case does that correspond to?

[*] I am going the opposite way here, adding to the list rather than  
removing from it, to avoid having the issue described at  
http://lists.w3.org/Archives/Public/www-style/2011Apr/0352.html complicate  
matters.

-- 
Øyvind Stenhaug
Opera Software ASA
Received on Tuesday, 15 January 2013 18:09:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT