Spec, stylesheet, glitch script, Claude Code skill and the design canvas source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
564 B
JavaScript
16 lines
564 B
JavaScript
// Night Grid: glitch one random .ng-glitch element every 6–14s (~10s average).
|
||
(() => {
|
||
if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
||
const next = () => setTimeout(tick, 6000 + Math.random() * 8000);
|
||
const tick = () => {
|
||
const els = document.querySelectorAll('.ng-glitch');
|
||
const el = els[Math.floor(Math.random() * els.length)];
|
||
if (el) {
|
||
el.classList.add('is-glitching');
|
||
el.addEventListener('animationend', () => el.classList.remove('is-glitching'), { once: true });
|
||
}
|
||
next();
|
||
};
|
||
next();
|
||
})();
|