176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
fix: Smooth Scroll README snippet clears raf and keeps the next frame id
matinfa35d1c6af0f
diff --git a/animations/01-scroll-based/smooth-scroll/README.md b/animations/01-scroll-based/smooth-scroll/README.mdindex 01826a85..9ec09b5e 100644--- a/animations/01-scroll-based/smooth-scroll/README.md+++ b/animations/01-scroll-based/smooth-scroll/README.md@@ -30,12 +30,13 @@ viewport.addEventListener('wheel', e => {// each frame eases current toward target, by a share that depends on how long the frame tookconst FRAME = 1000 / 60; // ease is counted per 1/60 sfunction loop(now) {+ raf = 0;const dt = last ? Math.min(now - last, 50) : FRAME; // time since the last frame; 1/60 s for the firstlast = now;current += (target - current) * (1 - Math.pow(1 - ease, dt / FRAME)); // ease ~0.09if (Math.abs(target - current) < 0.1) current = target;content.style.transform = `translate3d(0, ${-current}px, 0)`;- if (current !== target) requestAnimationFrame(loop);+ if (current !== target) raf = requestAnimationFrame(loop);}function kick() { if (!raf) { last = 0; raf = requestAnimationFrame(loop); } }```