Time-Based CSS Animations
yuanchuan.dev
Time-Based CSS Animations
1–10 of 49 posts
Re: Time-Based CSS Animations
#2e.g. animation-delay: -1500ms will begin the animation immediately but jump to 1.5s into the animation. Controlling this value with JS lets you effectively scrub through CSS animations via JS, making every animation compatible with game-engine style compute-update-render tick loops.
https://developer.mozilla.org/en-US/docs/Web/CSS/animation-d...
Re: Time-Based CSS Animations
#3I also recommend using negative animation delay values if you want to control the progress via JS. e.g. animation-delay: -1500ms will begin the animation immediately but jump to 1.5s into the animation. Controlling this value with JS lets you effectively scrub through CSS animations via JS, making every animation compatible with game-engine style compute-update-render tick loops. https://developer.mozilla.org/en-US/d…
Re: Time-Based CSS Animations
#4Edit: Just read the disclaimer, whoops!
Re: Time-Based CSS Animations
#5Whatever you're doing isn't working on Firefox. Edit: Just read the disclaimer, whoops!
Re: Time-Based CSS Animations
#6 CSS now has enough Math functions supported,
particularly mod(), round(), and trigonometric
functions
CSS can not start a timer like JavaScript does,
but nowadays it's possible to define a custom
variable with the CSS Houdini API to track time
in milliseconds.
Why do we need all this when we have JavaScript?Shouldn't the drawing layer be concerned with drawing primitives? Why put more and more of the higher layers into it?
Re: Time-Based CSS Animations
#7Re: Time-Based CSS Animations
#8CSS now has enough Math functions supported, particularly mod(), round(), and trigonometric functions CSS can not start a timer like JavaScript does, but nowadays it's possible to define a custom variable with the CSS Houdini API to track time in milliseconds. Why do we need all this when we have JavaScript? Shouldn't the drawing layer be concerned with drawing primitives? Why put more and more of the higher layers i…
Jokes aside, CSS is declarative and while there is overlap between problems solvable by JS and CSS, I think that’s only natural.
I’m actually really excited for all the new features added to CSS lately, less interpreted code is better.
Re: Time-Based CSS Animations
#9I also recommend using negative animation delay values if you want to control the progress via JS. e.g. animation-delay: -1500ms will begin the animation immediately but jump to 1.5s into the animation. Controlling this value with JS lets you effectively scrub through CSS animations via JS, making every animation compatible with game-engine style compute-update-render tick loops. https://developer.mozilla.org/en-US/d…
That should also enable iOS style, scroll-offset bound animations, right?
We built a high performance animation library on this concept: https://github.com/Monadical-SAS/redux-time
Re: Time-Based CSS Animations
#10CSS now has enough Math functions supported, particularly mod(), round(), and trigonometric functions CSS can not start a timer like JavaScript does, but nowadays it's possible to define a custom variable with the CSS Houdini API to track time in milliseconds. Why do we need all this when we have JavaScript? Shouldn't the drawing layer be concerned with drawing primitives? Why put more and more of the higher layers i…