Re: Are CSS animations a done deal?

On Mar 28, 2010, at 8:32 AM, Lars Gunther wrote:

> The recent discussion about CSS transitions and animations made me wonder if it has been finally decided that CSS animations will become a W3C recommendation?
> 
> I am a big fan of declarative animation and would not like for this to disappear into thin air.
> 
> But:
> 
> Does animation really belong in CSS? Can someone point me to the discussion where this was discussed and perhaps even decided?

Discussion so far has focused on the Transitions module, which has good support. Reception for Animations has been mixed.

> 1. There are many things that could trigger an animation, as opposed to a transition. Not only clicks, focus and hover, but also submits, gestures, various load states, changes to the DOM, etc. For this reason JavaScript authors will write wrapper functions and through these wrapper functions animations will be triggered for a majority of all use cases.

I don't see the fact that animations may often be triggered from JavaScript as an argument that they must be triggered only from JavaScript.  I think it would unfortunate if there was no way to trigger animations from CSS (e.g. in a :hover rule).

> 2. Manipulation of style and the DOM is done through scripting today. If animation is done imperatively it's through the DOM, if done declaratively it should be the same.

I can't quite parse that last sentence.

Let me reiterate the reasons why we think declarative animation in CSS is a good idea:

* Declarative animation is good for ease of authoring.
* Declarative animation allows the user agent to make optimizations that are impossible with iterative animation via script (this is very important on lower-power devices).
* Many CSS animations are presentational; ambient backgrounds animations, button that pulse when hovered etc.
* Animations operate on CSS properties, so it makes sense to declare the keyframes in CSS.
* Given declarative animations in CSS, you can easily layer a JavaScript API on top (even via a JS library). It's not possible to do the reverse.
* It would be odd to have presentational changes in the document (like animation via some non-CSS-based API) coming from a non-CSS source. What would getComputedStyle() return?

Simon

Received on Monday, 29 March 2010 16:58:04 UTC