4 ms·
I wish CSS had two related things - A function similar to linear() that supports control points so we can make multi-point Bezier paths. - calc() support as a
by spankalee 1y ago
I wish CSS had two related things
- A function similar to linear() that supports control points so we can make multi-point Bezier paths.
- calc() support as an easing function so you could combine sin(), etc., and do oscillation with damping.
- A spring() function that remembers the current velocity for when parameters change.
- magicalhippo 1y agoI'm not a web guy. Why would you want that in CSS when you have Javascript?
- paulhebert 1y agoJS tends to be slower to load, parse and run than CSS. Additionally, animations are often tightly linked to your page styles which are set in CSS. It’s easier to reason about them if they’re all in the same file and language instead of split across CSS and JS.
- mminer237 1y agoOff the top of my head: * It's easier to write without pulling in dependencies. * Being simpler syntax means smaller page sizes. * In theory, CSS animations can be faster. * You don't have to worry about attaching listeners to dynamic content. * Styling with JS violates Separation of Concerns. * `prefers-reduced-motion` is only available in CSS, so JS has to run a CSS query anyway.
- Sesse__ 1y agoCSS animations run in the compositor thread, so they are isolated from jank due to concurrently running JS.
- deleted 1y ago[deleted]
- alt187 1y agoAnother argument, this time for performance: JavaScript is single-threaded, so while you wait for your hyper-detailed spring animation to play out, the JS engine does literally nothing else.
- SweetSoftPillow 1y agoFor performance reasons we always prefer HTML, then CSS, and only then JS as a last resort.