W3C home > Mailing lists > Public > www-style@w3.org > April 2010

Re: transitions vs. animations

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 7 Apr 2010 20:06:43 -0700
Message-ID: <i2kdd0fbad1004072006l99ab80fdk653e75894399ae7c@mail.gmail.com>
To: Perry Smith <pedzsan@gmail.com>
Cc: Håkon Wium Lie <howcome@opera.com>, "www-style@w3.org list" <www-style@w3.org>
On Wed, Apr 7, 2010 at 7:46 PM, Perry Smith <pedzsan@gmail.com> wrote:
> On Apr 7, 2010, at 8:00 PM, Tab Atkins Jr. wrote:
>> 2b:
>> foo:hover {
>>  play-in: bounce 1s;
>>  play-out: bounce 1s;
>> }
> I thought 2b would be:
> foo {
>  play-in: bounce 1s;
> }
> foo:hover {
>  play-in: bounce 1s;
> }
> Are these two "roughly" equivalent or is there a difference?

Big difference.  In your version, the value of the play-in property
doesn't change between hovering and not - the entire time the element
just sees "play-in: bounce 1s;", and so no animation runs.  Animations
in my proposal decide when to run in the same way as the current draft
- when an element's animation (or in this case, play-in) property
changes, it looks to see if any animations have been added or removed.

Doing it in the way you describe *seems* intuitive, but that way lies
madness - there's nothing in ordinary CSS terms that lets the element
know that it should run the animation when it hovers, since *nothing
has changed*.  You have to define some entirely new way of
communicating property values, where they know what selectors they're
specified under, which is all kinds of crazy.

(Plus, your example still doesn't quite work - even if animations
could be made to work in the way you're envisioning, you'd have to
attach them to foo:hover and foo:not(:hover), since if you match
foo:hover you *also* still match plain foo.)

Received on Thursday, 8 April 2010 03:07:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:34 UTC