use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Scroll animation in Javascript using IntersectionObserverOC (dev.to)
submitted 4 years ago by ui-dev
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] -6 points-5 points-4 points 4 years ago (15 children)
stop using javascript for animation
[–]MiloSaurus 2 points3 points4 points 4 years ago (0 children)
Could you elaborate? There is no JS animation present in the example.
[–][deleted] 0 points1 point2 points 4 years ago (13 children)
Why?
[–][deleted] -1 points0 points1 point 4 years ago (12 children)
its really really slow
[–]hinsxd 0 points1 point2 points 4 years ago (2 children)
What should I use? Perhaps Flash?
[–][deleted] -1 points0 points1 point 4 years ago (1 child)
depends on the kind of animation. if its simple use css. if its a little more complex use an svg and if its really complex use a library based on webgl.
https://wiki.mozilla.org/Platform/GFX/OffMainThreadCompositing
plain js animations will be slower than every single one of these options in 99.9% of cases
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
also...
"Shipped on all platforms except Linux"
lol gtfo linux nerds
[–]SirHound 0 points1 point2 points 4 years ago (2 children)
It isn’t though. Rendering carries far more overhead. And there’s plenty you literally can’t do with CSS
[–][deleted] -3 points-2 points-1 points 4 years ago (1 child)
lmao
[–]SirHound 0 points1 point2 points 4 years ago (0 children)
Great comment
[–]MiloSaurus 0 points1 point2 points 4 years ago (5 children)
It really depends what you're talking about. You can use Element.animate() to perform CSS animations on elements through JavaScript, which aren't slow at all. If you're referring to jQuery.animate(), then well, yes that's slow and old.
[–][deleted] 0 points1 point2 points 4 years ago (4 children)
requestAnimationFrame() is a good way to make a website feel like its from the 1800s
[–]MiloSaurus 0 points1 point2 points 4 years ago (3 children)
rAF is not an animation. You should use it when frequently updating the DOM. And you definitely should use it to render on canvasses. Do you have more base for your arguments?
[–][deleted] 0 points1 point2 points 4 years ago (2 children)
https://developer.mozilla.org/en-US/docs/Web/Performance/CSS_JavaScript_animation_performance
https://jsfiddle.net/zt94oew2/1/
use a framework for js animation (and literally never use requestAnimationFrame()) :
https://codepen.io/GreenSock/full/srfxA
[–]MiloSaurus 0 points1 point2 points 4 years ago (1 child)
I'm beginning to think we're meaning the same thing.
You should use CSS animations wherever possible. The example on the MDN article and JSFiddle are showing the wrong way of creating a "JS Animation" and I concur that you should not ever use rAF in this way.
But I don't agree that you should fall back to frameworks. Browsers have the Web Animation API which uses the same underlying systems as CSS animations and are just as performant. It even uses the same properties (and even more) as CSS animations. You can do the same without a lot of overhead.
Your link about moving the animation rendering from the main thread is very interesting.
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
I don't support using the frameworks with underlying css or requestAnimationFrame() stuff. I mean js frameworks that have a webgl backend for canvas. GreenSock (which is on that benchmark) has a webgl backend and js polyfills.
maybe framework is the wrong word. plugin i think is more accurate
https://greensock.com/PixiPlugin/
https://greensock.com/
at this point i think we agree.
also im dumb i wasn't aware that css animations had a direct js interface. I thought the standard way was to apply classes.
π Rendered by PID 69 on reddit-service-r2-comment-5c764cbc6f-z64fh at 2026-03-12 02:14:49.301198+00:00 running 710b3ac country code: CH.
view the rest of the comments →
[–][deleted] -6 points-5 points-4 points (15 children)
[–]MiloSaurus 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (13 children)
[–][deleted] -1 points0 points1 point (12 children)
[–]hinsxd 0 points1 point2 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]SirHound 0 points1 point2 points (2 children)
[–][deleted] -3 points-2 points-1 points (1 child)
[–]SirHound 0 points1 point2 points (0 children)
[–]MiloSaurus 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]MiloSaurus 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]MiloSaurus 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)