Over a million developers have joined DZone.

CSS3 Transitions vs. jQuery Animate: Performance

DZone's Guide to

CSS3 Transitions vs. jQuery Animate: Performance

· Web Dev Zone ·
Free Resource

A true open source, API-first CMS — giving you the power to think outside the webpage. Try it for free.

Rich Bradshaw has written a detailed tutorial series on CSS Transitions, Transforms, and Animation.

That alone is worth reading; but in case you weren't convinced, Rich also put together a little (and maybe a little unfair) performance comparison:

A head to head comparison of CSS transitions and jQuery's animate. Rather than setting a timer to run repeatedly, transitions are handled natively by the browser. In my rather unscientific testing, transitions are always quicker, running with a higher frame rate, especially with high numbers of elements. They also have the advantage that colours can be animated easily, rather than having to rely on plugins.

The results probably won't surprise you, and the conclusion inevitable ('use CSS3 for animation when you can') but Rich's analysis (scroll down), using the Timeline view in the Webkit Inspector, is pretty neat:

(Actually, the Timeline is pretty neat, period. I didn't know about it until now..sweet.)

So check out Rich's test and performance discussion, and maybe use Webkit Inspector's Timelinefor performance fine-tuning in the future.

The New Standard for a Hybrid CMS: GraphQL Support, Scripting as a Service, SPA Support. Watch on-demand now.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}