TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Time-Based CSS Animations

241 pointsby spirit23about 1 year ago

13 comments

nikisweetingabout 1 year ago
I also recommend using negative animation delay values if you want to control the progress via JS.<p>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.<p><a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;animation-delay" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;animation-d...</a>
评论 #40262690 未加载
krebbyabout 1 year ago
For anything more advanced than a simple easing function or some basic keyframes on one or two channels you&#x27;ll quickly run into the limitations of this approach.<p>I&#x27;ve been using Theatre.js the last few years and really loving it. It&#x27;s a library divided into two parts; one is a studio UI with a timeline for editing keyframes and bezier curves, and the other is a runtime for taking those keyframes and interpolating values in relation to a timeline. Try it for anything that requires coordinated animations.<p><a href="https:&#x2F;&#x2F;www.theatrejs.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.theatrejs.com&#x2F;</a>
ulrischaabout 1 year ago
Very impressive. But somehow I think we just reached the point coming close to what we were able to do with flash decades before. I do not want flash back but a more user friendly tool to create css animations. If somebody knows any I would be glad.
TekMolabout 1 year ago
<p><pre><code> 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&#x27;s possible to define a custom variable with the CSS Houdini API to track time in milliseconds. </code></pre> Why do we need all this when we have JavaScript?<p>Shouldn&#x27;t the drawing layer be concerned with drawing primitives? Why put more and more of the higher layers into it?
评论 #40263140 未加载
评论 #40263212 未加载
评论 #40265687 未加载
评论 #40263267 未加载
评论 #40262984 未加载
评论 #40263957 未加载
simple10about 1 year ago
The article uses custom css @properties which are awesome and have 88% browser support [1].<p>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&#x27;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.<p>[1] <a href="https:&#x2F;&#x2F;caniuse.com&#x2F;?search=%40property" rel="nofollow">https:&#x2F;&#x2F;caniuse.com&#x2F;?search=%40property</a>
评论 #40266786 未加载
评论 #40267029 未加载
chrisjjabout 1 year ago
Interestingly without &#x27;Experimental feature flags&#x27; demos before mod() work, though mod() and sin() do nothing - on latest Android Chrome.
keepamovinabout 1 year ago
I wanted this for a while so I could do a &#x27;box-breathing&#x27; thing. With the inhale-hold-exhale-hold stages all being customizable to fit your body and go for the effect you wanted.<p>Could not figure out a way to do it (sans JS or insane complexity) without something like what&#x27;s on this page. Holy stylesheets! This page has really creative demos!!! Haha :)
评论 #40281587 未加载
simple10about 1 year ago
Really well written article. Chrome hasn&#x27;t yet released CSS support for mod() so most of the examples on the page don&#x27;t animate unless you&#x27;re using the preview release of Chrome.<p>If you&#x27;re not needing to control ticks and just want smooth CSS animations in all browsers, the FLIP method is useful:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;outsystems-experts&#x2F;flip-your-60-fps-animations-flip-em-good-372281598865" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;outsystems-experts&#x2F;flip-your-60-fps-anima...</a>
silvestrovabout 1 year ago
The animation at the bottom of the page is very impressive. It looks very much like a &lt;video&gt; rather than &lt;div&gt; elements.
rtcode_ioabout 1 year ago
<a href="https:&#x2F;&#x2F;RTCode.io" rel="nofollow">https:&#x2F;&#x2F;RTCode.io</a>, a real-time web playground without reloads (and without state resets) might greatly benefit anyone working with CSS animations&#x2F;transitions!<p>Demo on <a href="https:&#x2F;&#x2F;RTCode.io" rel="nofollow">https:&#x2F;&#x2F;RTCode.io</a><p>(To import pens, simply replace the hostname with xcodepen.io in your URLs.)
评论 #40267045 未加载
KRAKRISMOTTabout 1 year ago
Anyone want to try replicating YouTube&#x27;s upvote counter fly-in animation?
hartatorabout 1 year ago
Super good job. The clock looks super polished.
GalaxyNovaabout 1 year ago
Whatever you&#x27;re doing isn&#x27;t working on Firefox.<p>Edit: Just read the disclaimer, whoops!
评论 #40263815 未加载
评论 #40262796 未加载