Earlier quoted context omitted.
Don't forget that CSS animations are hardware accelerated. If you're doing trig in JS for animations, you're probably also manipulating the DOM to update the UI every millisecond, which is very expensive
Most CSS animations aren't hardware accelerated. Only a few values like opacity and transform. Updating the DOM (as in innerHTML) is always expensive because it triggers layout. This is true whether you're doing it from JS or a CSS trick like on this page. Finally this approach is using CSS custom properties. These are slow - slower than JS for most things. If you stop all animations on this page and profile it via C…
Time-Based CSS Animations
31–40 of 49 posts
Re: Time-Based CSS Animations
#32If you're not needing to control ticks and just want smooth CSS animations in all browsers, the FLIP method is useful:
https://medium.com/outsystems-experts/flip-your-60-fps-anima...
Re: Time-Based CSS Animations
#33One thing to watch out for is differences in how browsers handle setting the fallback initial-value. Chrome will use initial-value if CSS variable is undefined OR set to an invalid value. Firefox will only use initial-value if the variable is undefined. For most projects, this won't be an issue, but for a recent project, I ended up needing to use javascript to set default values in Firefox to iron out the inconsistency between browser implementations.
Re: Time-Based CSS Animations
#34The article uses custom css @properties which are awesome and have 88% browser support [1]. One thing to watch out for is differences in how browsers handle setting the fallback initial-value. Chrome will use initial-value if CSS variable is undefined OR set to an invalid value. Firefox will only use initial-value if the variable is undefined. For most projects, this won't be an issue, but for a recent project, I end…
Re: Time-Based CSS Animations
#35The article uses custom css @properties which are awesome and have 88% browser support [1]. One thing to watch out for is differences in how browsers handle setting the fallback initial-value. Chrome will use initial-value if CSS variable is undefined OR set to an invalid value. Firefox will only use initial-value if the variable is undefined. For most projects, this won't be an issue, but for a recent project, I end…
Get property value defined in :root{}:
getComputedStyle(document.documentElement).getPropertyValue("--some-custom-css-var");
Set property value:
document.documentElement.style.setProperty("--some-custom-css-var", "some value");
This can work as a polyfill for browsers that do not yet have CSS @property support enabled.
Re: Time-Based CSS Animations
#36https://RTCode.io , a real-time web playground without reloads (and without state resets) might greatly benefit anyone working with CSS animations/transitions! Demo on https://RTCode.io (To import pens, simply replace the hostname with xcodepen.io in your URLs.)
Re: Time-Based CSS Animations
#37https://RTCode.io , a real-time web playground without reloads (and without state resets) might greatly benefit anyone working with CSS animations/transitions! Demo on https://RTCode.io (To import pens, simply replace the hostname with xcodepen.io in your URLs.)
Has anyone tried RTCode yet? Looks interesting but the homepage is a bit confusing as to whether it's a CodePen replacement with realtime support or can also be used for production?
RTCode is in private alpha. (Currently building Code Versions: diff, rollback, A/B testing; and Code Search: full-text search across all your active deployments).
Our playground and network have proven stable in production in several large enterprises for the last year.
I can answer any questions via email (support@elefunc.com) or chat (https://meet.elefunc.com).
Re: Time-Based CSS Animations
#38Whatever you're doing isn't working on Firefox. Edit: Just read the disclaimer, whoops!
Oddly on my system, it works better in Firefox (it's not animated, but all the elements are there) than it does in Chromium (completely blank where the animated demo should be).