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: the finder keeps its answers, Not sure included, when a step changes only the fragment (How it works, Back to top, the skip link), and Start over keeps its words in the middle on phones
matin1cc7d89f6f2f
diff --git a/index.html b/index.htmlindex b3178d42..6f060f63 100644--- a/index.html+++ b/index.html@@ -361,7 +361,7 @@ button,input{font:inherit;color:inherit}.fd-unsure,.fd-how .fd-unsure{justify-content:center;border-style:dashed;background:none;color:var(--ink-2);font-weight:500}.fd-go{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:clamp(24px,4vw,40px)}.fd-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 26px;border-radius:999px;border:0;background:var(--ink);color:var(--bg);font-size:16px;font-weight:700;text-decoration:none;cursor:pointer}-.finder .pillbtn{min-height:52px;padding:0 24px;font-size:16px}+.finder .pillbtn{min-height:52px;padding:0 24px;font-size:16px;justify-content:center} /* Start over keeps its words in the middle when a phone stretches it */.fd-gline{margin:-12px 0 18px;font-size:15px;color:var(--muted)}@media(hover:hover){.fd-a:hover{border-color:var(--ink)}}@media(max-width:1024px){.fd-as{grid-template-columns:repeat(4,minmax(0,1fr))}}@@ -2983,12 +2983,13 @@ $('more-btn').addEventListener('click',()=>{});// A click with Ctrl, Cmd, Shift or Alt, or with another button, is left to the browser (a new tab or window).$('nav-all').addEventListener('click',e=>{if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;e.preventDefault();go({view:'all'},true);toResults();toTitle();});-// Back and Forward over a fragment only (the skip link, How it works, Back to top) leave the view and keyboard focus as they-// are. A view they change can take away the control that had keyboard focus (the ninth card after Show all): the heading gets-// it, the finder's heading in the finder.+// A step that changes only the fragment (the skip link, How it works, Back to top), and Back and Forward over one, leave the+// view, the finder's answers and keyboard focus as they are: Not sure, which the address never holds, counts as no answer there.+// A view they change can take away the control that had keyboard focus (the ninth card after Show all): the heading gets it,+// the finder's heading in the finder.addEventListener('popstate',()=>{const {next}=fromURL();- if(Object.keys(next).every(k=>next[k]===state[k]))return;+ if(Object.keys(next).every(k=>next[k]===state[k]||next[k]===''&&state[k]==='unsure'))return;readURL();render();const a=document.activeElement;if(!a||a===document.body||gone(a)){if(state.view==='find')findTitle.focus({preventScroll:true});else toTitle();}});diff --git a/tests/finder.test.js b/tests/finder.test.jsindex 2dcec55e..2094ef9b 100644--- a/tests/finder.test.js+++ b/tests/finder.test.js@@ -235,6 +235,26 @@ test('the address keeps the finder and its answers: ?view=find, then what, whenassert.deepEqual(calls.pop(), ['replace', '?view=find&what=text&when=scroll&how=draw&all=1'], 'answers and Show all only replace the address');});+test("a step that changes only the fragment (How it works, Back to top, the skip link) leaves the finder's answers as they are, Not sure included; a step to another address reads it", () => {+ const calls = [];+ const page = finder({ URLSearchParams, location: { search: '', pathname: '/animation-handbook/' }, q: { value: '' }, q2: { value: '' },+ document: { body: {}, activeElement: {} }, gone: () => false, render: () => calls.push('render'), toTitle: () => calls.push('toTitle'),+ findTitle: { focus: () => calls.push('findTitle') }, addEventListener: (type, fn) => { if (type === 'popstate') page.popstate = fn; } });+ for (const name of ['fromURL', 'readURL']) vm.runInContext(source(name), page);+ const start = at("addEventListener('popstate',");+ vm.runInContext(HOME.slice(start, blockEnd(HOME.indexOf('{', start)) + 1) + ')', page);+ const none = { q: '', place: '', view: '', all: false, what: '', when: '', how: '' };+ page.state = { ...none, view: 'find', what: 'text', when: 'unsure' };+ page.location.search = '?view=find&what=text';+ page.popstate();+ assert.deepEqual(plain(page.state), { ...none, view: 'find', what: 'text', when: 'unsure' }, 'the answers stay, Not sure included');+ assert.deepEqual(calls, [], 'nothing is drawn again and keyboard focus stays');+ page.location.search = '?view=find&what=button';+ page.popstate();+ assert.deepEqual(plain(page.state), { ...none, view: 'find', what: 'button' }, "another address's answers, without Not sure, which no address holds");+ assert.deepEqual(calls, ['render'], 'the view is drawn again');+});+// ── Every card's answers and the test set ──// The reviewed answers: every answer given to some card, the rules every page of a kind shares, and the spec's 28 described effects.