Skip to content

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.

Merge af/not: Not here? and Describe it in words, the issue form and the chooser's finder link

matin65f52d0fd239
diff --cc index.html
index 97f1f5d6,ab9e471f..a7f276c9
--- a/index.html
+++ b/index.html
@@@ -373,14 -373,14 +373,22 @@@ button,input{font:inherit;color:inherit
.fd-how .fd-a{padding:8px 4px 10px;font-size:13px}
.fd-go{flex-direction:column;align-self:stretch}
}
+/* The ways into the finder: a pill under the Popular line (as wide as the column on phones) and Finder in the top bar, marked as
+ the current page in the finder. Below 870px (measured) Finder, Browse all and How it works no longer all fit beside the brand,
+ so How it works leaves the bar; its band stays on the page. Phones show no top-bar links: there the pill is the way in. */
+.find-cta{display:inline-flex;align-items:center;justify-content:center;min-height:44px;margin-top:10px;padding:0 20px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font-size:15px;font-weight:700;text-decoration:none}
+.lnk[aria-current="page"]{color:var(--ink);background:var(--line-2)}
+@media(hover:hover){.find-cta:hover{border-color:var(--ink)}}
+@media(max-width:869px){.top .nav .lnk[href="#how"]{display:none}}
+@media(max-width:600px){.find-cta{display:flex;align-self:stretch;margin-top:8px}}
+ /* Not here?, under the finder's cards whenever an answer is picked */
+ .fd-not{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:40px;padding:clamp(28px,4vw,44px) 24px;border-radius:20px;background:var(--surface);box-shadow:var(--shadow);text-align:center}
+ .fd-not-t{font-size:22px;font-weight:800}
+ .fd-not-s{max-width:560px;font-size:16px;color:var(--ink-2)}
+ .fd-not-acts{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin-top:4px}
+ .fd-fine{font-size:14px;color:var(--muted)}
+ .fd-not .pillbtn{min-height:52px;padding:0 24px;font-size:16px;justify-content:center} /* Describe it in words, as Start over: as tall as the dark button beside it, its words in the middle when a phone stretches it */
+ @media(max-width:600px){.fd-not-acts{flex-direction:column;align-self:stretch}}
/* ── preview library ── */
/* The hint names the transform only: opacity in will-change flattens CSS 3D in Chrome (a cube draws as one flat face) */
@@@ -3066,17 -3070,17 +3081,28 @@@ finderEl.addEventListener('change',e=>
});
findSee.addEventListener('click',()=>{toResults();toTitle();});
$('find-reset').addEventListener('click',()=>{go({view:'find'},false);scrollTo({top:0,behavior:reduce?'auto':'smooth'});findTitle.focus({preventScroll:true});});
+// The ways in: the Find button under the search and Finder in the top bar open the finder with one history step, at the top of
+// the page with keyboard focus on its heading (the Find button goes away with the hero). A click with Ctrl, Cmd, Shift or Alt,
+// or with another button, is left to the browser, as for Browse all.
+const navFind=$('nav-find');
+function enterFind(e){
+ if(e.button||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;
+ e.preventDefault();
+ if(state.view!=='find')go({view:'find'},true);
+ scrollTo({top:0,behavior:reduce?'auto':'smooth'});findTitle.focus({preventScroll:true});
+}
+document.querySelectorAll('.find-cta,#nav-find').forEach(a=>a.addEventListener('click',enterFind));
+ // Not here?, under the cards whenever an answer is picked: its link opens the GitHub form with the answers filled in; when nothing
+ // fits, its line says so and suggests Not sure on one question. Describe it in words goes back to the start, search box focused.
+ const findNot=$('find-not'),findNotLine=$('find-not-s'),findGh=$('find-gh');
+ function showNotHere(finding,found){
+ const answered=finding&&answeredAny();
+ findNot.hidden=!answered;
+ if(!answered)return;
+ findNotLine.textContent=found.best.length+found.close.length?'Tell us what you saw. We use it to add the animation or to fix the finder.':'Nothing fits these answers yet. Try Not sure on one question, or tell us what you saw.';
+ findGh.href=findIssueURL(state);
+ }
+ $('find-words').addEventListener('click',()=>{go({},true);scrollTo({top:0,behavior:reduce?'auto':'smooth'});q.focus({preventScroll:true});});
const startCat=readURL();
render();
if(startCat){const g=$('cat-'+startCat);if(g)g.scrollIntoView();}
diff --cc tests/finder.test.js
index f0b14a32,d0d95ba8..8b6aeb35
--- a/tests/finder.test.js
+++ b/tests/finder.test.js
@@@ -255,17 -255,52 +255,63 @@@ test("a step that changes only the frag
assert.deepEqual(calls, ['render'], 'the view is drawn again');
});
+test('the ways into the finder: the Find button under the Popular line, Finder right before Browse all, both left out of the social picture', () => {
+ assert.equal(count(HOME, `<a class="find-cta" href="?view=find">Don't know the name? Find it</a>`), 1, 'one Find button');
+ assert.match(between(HOME, '<section class="wrap home-hero"', '</section>'),
+ /<p class="pop"><span>Popular:<\/span>.*<\/p>\s*<a class="find-cta" href="\?view=find">Don't know the name\? Find it<\/a>\s*$/, 'the Find button ends the hero, right under the Popular line');
+ assert.match(between(HOME, '<nav class="nav" aria-label="Site">', '</nav>'),
+ /<a class="lnk" id="nav-find" href="\?view=find">Finder<\/a>\s*<a class="lnk" id="nav-all" href="\?view=all">Browse all<\/a>/, 'Finder right before Browse all');
+ const css = [...HOME.matchAll(/<style>([\s\S]*?)<\/style>/g)].map(m => m[1]).join('\n');
+ assert.ok(css.includes('@media(max-width:869px){.top .nav .lnk[href="#how"]{display:none}}'), 'How it works leaves the bar where the three links no longer fit');
+ assert.ok(read(path.join(ROOT, 'tools', 'make-social-image.mjs')).includes('.find-cta, #nav-find { display: none }'), 'the social picture leaves both out');
+});
+
+ // The fields of a GitHub issue form, in order: each item of its body that has an id, with its type, label and whether it is required.
+ const formFields = yml => yml.split(/\n - type: /).slice(1).map(item => ({
+ type: item.split(/\r?\n/)[0].trim(),
+ id: (item.match(/\n id: (\S+)/) || [])[1],
+ label: ((item.match(/\n label: (.+)/) || [])[1] || '').trim().replace(/^"(.*)"$/, '$1'),
+ required: /\n required: true/.test(item)
+ })).filter(field => field.id);
+ const FORM = path.join(ROOT, '.github', 'ISSUE_TEMPLATE', 'animation_not_here.yml');
+
+ test('Not here? sits under the cards with its words, its GitHub link in a new tab and Describe it in words', () => {
+ const panel = between(HOME, '<div class="fd-not" id="find-not" hidden>', '</div>');
+ assert.ok(panel, 'the Not here? panel, hidden until an answer is picked');
+ for (const part of ['<h3 class="fd-not-t">Not here?</h3>',
+ '<p class="fd-not-s" id="find-not-s">Tell us what you saw. We use it to add the animation or to fix the finder.</p>',
+ '<a class="fd-btn" id="find-gh" href="https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml" target="_blank" rel="noopener">Tell us on GitHub</a>',
+ '<button type="button" class="pillbtn" id="find-words">Describe it in words</button>',
+ '<p class="fd-fine">The form is on GitHub and needs a free account.</p>']) assert.ok(panel.includes(part), part);
+ assert.ok(at('id="find-not"') > at('id="more"') && at('id="find-not"') < at('id="how"'), 'under the cards, before How it works');
+ });
+
+ test('the GitHub form for Not here? has its name, title, label and four fields', () => {
+ const form = read(FORM);
+ assert.match(form, /^name: "Can't find an animation"\r?$/m);
+ assert.match(form, /^description: "You saw an animation on a website, and the finder did not show it\."\r?$/m);
+ assert.match(form, /^title: "\[not here\] "\r?$/m);
+ assert.match(form, /^labels: \["finder"\]\r?$/m);
+ assert.deepEqual(formFields(form).map(f => [f.type, f.id, f.label, f.required]), [
+ ['input', 'answers', 'Your answers in the finder', false],
+ ['input', 'site', 'Where did you see it? A link, and where on the page', true],
+ ['textarea', 'what', 'What happened, in your own words', true],
+ ['textarea', 'recording', 'A screen recording or picture: drag it into this box', false]
+ ]);
+ });
+
+ test('the Not here? link names animation_not_here.yml and fills only fields the form has', () => {
+ const fields = formFields(read(FORM)).map(f => f.id);
+ const url = new URL(finder().findIssueURL({ what: 'card', when: 'scroll', how: 'pieces' }));
+ assert.equal(url.searchParams.get('template'), path.basename(FORM));
+ for (const name of url.searchParams.keys()) assert.ok(['template', 'title'].includes(name) || fields.includes(name), `${name} is a field of the form`);
+ });
+
+ test('the issue chooser offers the finder first', () => {
+ const config = read(path.join(ROOT, '.github', 'ISSUE_TEMPLATE', 'config.yml'));
+ assert.match(config.split(/\r?\n - name: /)[1] || '', /^Find an animation by what you saw\r?\n url: https:\/\/matinmonshizadeh\.github\.io\/animation-handbook\/\?view=find\r?\n/);
+ });
+
// ── 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.