5 ms·
Shouldn't pure CSS animations have better performance?
by creshal 10y ago
Shouldn't pure CSS animations have better performance?
- awesomerobot 10y agoIf you have a sane amount of JS (ie, not loading entire libraries to accomplish an accordion) the performance differences should be negligible.
- nevir 10y agoCSS animations are generally on par with JavaScript, except when they're hardware accelerated. But that's changing once web animations (https://w3c.github.io/web-animations/ https://w3c.github.io/web-animations/) hits mainstream anyway - both CSS & JS get access to the same engine.
- TD-Linux 10y agoThe point of CSS animations isn't HW accel - you get that just from layerization. What it does get you is animations executing off the JS thread, so if you have piles of third party JS it won't cause frame drops.
- at-fates-hands 10y agoGood point. If you use Wordpress, like millions of people do, you will have a fuck ton of JS plugins running, so I can see where this would be advantageous.
- nevir 10y agoRight, which you also get via the web animations API (queue up animations, and have them run on a separate thread)
- vkjv 10y agoThe animation, yes, but not the trigger. You can balance this by adding / removing classes in javascript (to limit the complexity in CSS) and with the class performing the animation.