2 ms·
An optimisation I've always wondered about for transforming/translating/animating elements: is it faster to use JS translations or animation API directly on the
by dleeftink 1y ago
An optimisation I've always wondered about for transforming/translating/animating elements: is it faster to use JS translations or animation API directly on the element (e.g. style.transform / element.animate), or updating CSS variables with JS to let the CSS engine reposition inheriting elements?
In the context of animations, I'd intuit the latter but would be open to hearing why.
- Sesse__ 1y agoYou want CSS transitions or animations, since they can run on the compositor thread (most of the time). Zero jank. (I work with CSS browser performance, although animations is not my primary field)
- cluckindan 1y agojQuery has .animate() which uses the JS API and used to be very popular. When CSS Animations became available, that part of jQuery became obsolete overnight.