Re: Animations in CSS or the DOM - what does the DOM community say?

On Thu, Apr 22, 2010 at 4:07 PM, Lars Gunther <gunther@keryx.se> wrote:
>   1. First you capability detect support for declarative animation. That in
> itself would be easier if it was in the DOM, but it is at least doable now.
> But not in a neat fashion. Score one against having animations in CSS.

This argument applies equally to *every* CSS feature.  It's easier to
feature-test for *any* DOM property than it is to capability-test for
*any* CSS property.


>   2. If CSS-animation is indeed supported, you will wrap your animate
> function around className switches. Doable, but not neat.

Why would you have to do this?  You can just manipulate the function
of the animation property directly, like you would with anything else
in scripted CSS manipulation.  CSS animations decide when to fire
based on the value of the animation property changing, not based on
classes changing (though class changes may cause the animation
property's value to change, of course).


>   3. If CSS-animation is unsupported, you fall back to old school timed
> manipulation of the style attribute.
>
>     * However, using the animation parameters from the CSS-file is a huge
> impracticality. You must find a way to read all CSS-files, parse them and
> interpret the cascade, the specificitivity of all animation rules and
> convert that information into timed logic. This is impractical, slow and
> CPU-draining and fragile.

This is true of *any* CSS property that is currently unsupported, and
that you wish to emulate in script.  Dealing with @rules is somewhat
more difficult than not doing so, but there are now JS CSS parsers
(see http://glazman.org/JSCSSP/ ) that do the job for you.


> It can safely be said, that CSS-animations are not backwards compatible in
> any reasonable way. And we are going to need backwards compatible solutions
> for almost another decade or so.

Animations degrade more-or-less safely if you do them right.  They
aren't significantly more difficult to fake in script than any other
CSS property, especially given modern javascript tools.

~TJ

Received on Thursday, 22 April 2010 23:36:54 UTC