From c5078a2adf338703d7b7a3d62e6594fe2831bc5d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 11 May 2026 11:32:35 +0200 Subject: feat: hero name glitch effect on homepage Chromatic aberration glitch on h1.hero-name. Gravatar moved from markdown shortcode to template. JS fires randomly every 4-11s. Respects prefers-reduced-motion. Co-Authored-By: Claude Sonnet 4.6 --- assets/js/hero-glitch.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 assets/js/hero-glitch.js (limited to 'assets/js') diff --git a/assets/js/hero-glitch.js b/assets/js/hero-glitch.js new file mode 100644 index 0000000..1b39b2f --- /dev/null +++ b/assets/js/hero-glitch.js @@ -0,0 +1,12 @@ +(function () { + var name = document.querySelector('.hero-name'); + if (!name) return; + if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; + + function glitch() { + name.classList.add('is-glitching'); + setTimeout(function () { name.classList.remove('is-glitching'); }, 500); + setTimeout(glitch, 4000 + Math.random() * 7000); + } + setTimeout(glitch, 3500); +})(); -- cgit v1.2.3