openvibers/afresume Commits

Drive scroll reveals via Web Animations API — immune to OS reduced-motion suppression

OP OpenVibers committed 17 May 2026 · ff85bfaf67 · 2 files, +15 −8


Changes

ddiff --git a/src/layouts/Base.astro b/src/layouts/Base.astro
iindex 98b6148..57491d6 100644
---- a/src/layouts/Base.astro
++++ b/src/layouts/Base.astro
@@@ -81,16 +81,25 @@ const pageUrl = canonical ?? new URL(Astro.url.pathname, Astro.site).toString();
<Footer />
<script>
-- // Reveal-on-scroll
++ // Reveal-on-scroll — Web Animations API so OS reduced-motion can't suppress it
const io = new IntersectionObserver((entries) => {
for (const e of entries) {
if (e.isIntersecting) {
-- e.target.classList.add("in");
-- io.unobserve(e.target);
++ const el = e.target as HTMLElement;
++ el.style.opacity = '1';
++ el.style.transform = 'none';
++ el.animate(
++ [
++ { opacity: 0, transform: 'translateY(24px)' },
++ { opacity: 1, transform: 'translateY(0)' }
++ ],
++ { duration: 600, easing: 'cubic-bezier(0.22, 1, 0.36, 1)', fill: 'forwards' }
++ );
++ io.unobserve(el);
}
}
-- }, { rootMargin: "0px 0px -10% 0px", threshold: 0.05 });
-- document.querySelectorAll("[data-reveal]").forEach((el) => io.observe(el));
++ }, { rootMargin: '0px 0px -8% 0px', threshold: 0.05 });
++ document.querySelectorAll('[data-reveal]').forEach((el) => io.observe(el));
// Theme toggle
const KEY = "afnet-theme";
ddiff --git a/src/styles/global.css b/src/styles/global.css
iindex 7b1d282..75c8acc 100644
---- a/src/styles/global.css
++++ b/src/styles/global.css
@@@ -150,11 +150,9 @@ section { padding: clamp(60px, 10vw, 120px) 0; position: relative; }
}
.skip-link:focus { left: 12px; }
--/* Reveal */
++/* Reveal — initial hidden state only; animation driven by JS (Web Animations API) */
[data-reveal] {
opacity: 0;
transform: translateY(24px);
-- transition: opacity .8s var(--ease), transform .8s var(--ease);
-- will-change: opacity, transform;
}
[data-reveal].in { opacity: 1; transform: none; }