5 ms·
Hey, this is exactly what I was looking for! Thanks. Can someone explain why css animations are more efficient than javascript animations? Or is it just a matte
by LAMike 14y ago
Hey, this is exactly what I was looking for! Thanks. Can someone explain why css animations are more efficient than javascript animations? Or is it just a matter of preference
- quarterto 14y agoModern browsers can hardware-accelerate CSS animations. http://blog.teamtreehouse.com/increase-your-sites-performance-with-hardware-accelerated-css http://blog.teamtreehouse.com/increase-your-sites-performanc...
- dbushell 14y agojQuery animate (and any JS animation) iterates over CSS properties by updating an elements style attribute. Updating the DOM at this rate forces repaint/reflows and is rarely going to perform well. CSS transitions/transforms let the browser render once on separate layers. The animation frames can then be composited faster (and accelerated on the GPU). Paul Irish has a great demo: http://paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/ http://paulirish.com/2012/why-moving-elements-with-translate...