diff options
Diffstat (limited to 'assets/js/glitch.js')
| -rw-r--r-- | assets/js/glitch.js | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/assets/js/glitch.js b/assets/js/glitch.js deleted file mode 100644 index 85f8a00..0000000 --- a/assets/js/glitch.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * glitch.js - * Random glitch effect on .hero-name every 4-11 seconds - */ - -export function initGlitch() { - 'use strict'; - - const heroName = document.querySelector('.hero-name'); - if (!heroName) return; - - if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; - - function triggerGlitch() { - heroName.classList.add('is-glitching'); - setTimeout(() => { - heroName.classList.remove('is-glitching'); - }, 450); - } - - function scheduleNextGlitch() { - const delay = Math.random() * 7000 + 4000; // 4-11 seconds - setTimeout(() => { - triggerGlitch(); - scheduleNextGlitch(); - }, delay); - } - - scheduleNextGlitch(); -} |
