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

Re: transitions vs. animations

From: Simon Fraser <smfr@me.com>
Date: Thu, 08 Apr 2010 14:06:07 -0700
Cc: Brad Kemper <brad.kemper@gmail.com>, Håkon Wium Lie <howcome@opera.com>, Perry Smith <pedzsan@gmail.com>, "www-style@w3.org list" <www-style@w3.org>
Message-id: <E5DA4187-E881-464D-86E5-0E07AEC41855@me.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
On Apr 8, 2010, at 12:38 PM, Tab Atkins Jr. wrote:

> I've seen a few sites (can't find a URL right now, sorry) that have a
> very cool animation on their main navigation using javascript.  The
> text of the nav link is naturally at the top of the block, but when
> you hover over it it drops the bottom quickly, bounces, and settles
> down.  When you unhover, it flies up and bounces the same way.
> 
> Without any fanciness, this is just a change in positioning.  With
> transitions, we can trivially make this a smooth slide from being
> positioned at the top to being at the bottom.

Actually, you can't transition from "top: 0" to "bottom: 0", just as you can't
transition between "height: auto" to "height: 50px". The reason is that the
user agent would have to do a layout in order to compute the final state
before starting the transition, and then, if some other state changes while
the transition is running, that final state becomes invalid.

> But to do the "fly and
> bounce" thing, you need an animation.  I want to use this idea of
> attaching an animation to a transition, as it generally *works* the
> way I want, but I want to override the default transition slide with
> my own keyframe path.

You could do the bounce effect with a more elaborate timing function.

> I think this sort of thing will be reasonably common, and so I believe
> that transition-animations should override the transition they're
> attached to, if they manipulate the same property.  I think we have
> reasonable freedom to later add an ability for the
> transition-animation to combine with the transition, rather than
> straight overriding it, but I don't think that's necessary *right now*
> to get it working.

If we end up attaching animations to transitions, then I agree that the
animation should override the transition. As I said in another email,
let's deal with additivity separately.

Simon
Received on Thursday, 8 April 2010 21:06:44 GMT

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