← Blurr Motion foundation-cursor-system
Categorie foundations Tier 1 Techniek #13 Deps

data-cursor drives state

1. Mechanisme — kopieer 1-op-1, geen styling-keuzes
// Mechanisme: foundation-cursor-system
import gsap from 'https://esm.sh/gsap@3.12.5';
// Pas toe op je eigen selector — geen stijlkeuzes hier.
if(window.matchMedia('(prefers-reduced-motion: reduce)').matches)return;
const cur=document.querySelector('.custom-cursor');
if(cur){document.addEventListener('mousemove',e=>{cur.style.transform='translate('+e.clientX+'px,'+e.clientY+'px)';});
document.querySelectorAll('[data-cursor]').forEach(el=>{el.addEventListener('mouseenter',()=>cur.setAttribute('data-state',el.dataset.cursor));el.addEventListener('mouseleave',()=>cur.removeAttribute('data-state'));});}
2. Skeleton — DOM + class-namen, mag herschikken
<!-- Skeleton: foundation-cursor-system -->
<div class="demo-block">
  <!-- DOM-structuur hier -->
</div>
3. Styling-template — verplicht eigen invulling per merk
/* Styling: foundation-cursor-system */
:root {
  --block-bg: ;
  --block-fg: ;
  --block-accent: ;
}