176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
fix: Spotlight Hover Glow is easier to see at first glance
matinad3bcf121c09
diff --git a/animations/04-micro-interactions/spotlight-hover/index.html b/animations/04-micro-interactions/spotlight-hover/index.htmlindex 4bfa2a1e..9eabc1e2 100644--- a/animations/04-micro-interactions/spotlight-hover/index.html+++ b/animations/04-micro-interactions/spotlight-hover/index.html@@ -21,7 +21,7 @@<meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Spotlight Hover Glow", "name": "Spotlight Hover Glow", "description": "A soft glow follows the pointer and lights card edges. Best for feature grids.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/spotlight-hover/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Spotlight Hover Glow"}</script><style>- :root{--ui-accent:#ff9d5c;--glow:#b98cff;--g:300px;--bw:1.5px}+ :root{--ui-accent:#ff9d5c;--glow:#b98cff;--g:300px;--bw:2px}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}.stage{display:flex;overflow:hidden;background:#09090b;padding:clamp(12px,2.4vw,24px)}/* touch-action none: a finger dragged over the cards moves the light instead of scrolling the page */@@ -29,11 +29,12 @@/* A card is a faint frame (its padding is the edge) around an opaque face */.sc{position:relative;overflow:hidden;border-radius:14px;padding:var(--bw);background:rgba(255,255,255,.09)}/* Both lights are the same soft disc, moved to the pointer by transform only: the one behind the face shows only at- the edge, the one inside the face lights it faintly */+ the edge, the one inside the face lights it faintly. The face light stays at 22% so the text over it keeps 4.5:1+ in every color (White is the closest) */.eg,.fg{position:absolute;left:0;top:0;width:var(--g);height:var(--g);margin:calc(var(--g)/-2) 0 0 calc(var(--g)/-2);border-radius:50%;pointer-events:none;opacity:0;transition:opacity .35s ease;will-change:transform,opacity}- .eg{background:radial-gradient(closest-side,var(--glow) 15%,color-mix(in srgb,var(--glow) 50%,transparent) 55%,transparent)}- .fg{background:radial-gradient(closest-side,color-mix(in srgb,var(--glow) 20%,transparent),transparent)}+ .eg{background:radial-gradient(closest-side,var(--glow) 30%,color-mix(in srgb,var(--glow) 60%,transparent) 65%,transparent)}+ .fg{background:radial-gradient(closest-side,color-mix(in srgb,var(--glow) 22%,transparent) 30%,transparent)}.grid.lit .eg,.grid.lit .fg{opacity:1}.grid.no-edge .eg{visibility:hidden}.face{position:relative;display:flex;flex-direction:column;gap:6px;height:100%;overflow:hidden;border-radius:calc(14px - var(--bw));@@ -175,7 +176,7 @@const reduce=window.matchMedia('(prefers-reduced-motion: reduce)');const FRAME=1000/60; // one frame of a 60 Hz screen, in ms: ease is the share of the gap the light closes in one of them// lx,ly: where the light is; tx,ty: where it is heading (both on the grid, from its top left); W,H: the grid's size- let lx=0,ly=0,tx=0,ty=0,W=0,H=0,bw=1.5,k=1.15,ease=0.3,lit=false,raf=0,last=null,touchId=null,runTimers=[],runFrame=0;+ let lx=0,ly=0,tx=0,ty=0,W=0,H=0,bw=2,k=1.15,ease=0.3,lit=false,raf=0,last=null,touchId=null,runTimers=[],runFrame=0;// Card places and the light's size are measured once and again whenever the grid changes size; a pointer move reads only the grid's rectanglefunction measure(){