Re: transitions vs. animations

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.)

~TJ

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