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
feat: our version of the top bar that hides while you read, moved by the scroll itself as its site does on phones (checked 2026-10-22); every entry now has its version
matinb5fec2c1bb97
diff --git a/famous/index.html b/famous/index.htmlindex 6cc2bba0..74e6013e 100644--- a/famous/index.html+++ b/famous/index.html@@ -404,20 +404,29 @@ button{font:inherit;color:inherit}.gp-chart .k5{left:77.6cqw;--h1:6;--h2:3;--lit:1;--dim:1;--sx:-16.8cqw}.gp-chart .k6{left:86cqw;--h1:6;--h2:5;--lit:0;--dim:.26;--sx:0cqw}-/* the top bar that slides away while the page scrolls down and comes back when it scrolls up: a page that rises from the bottom edge */+/* the top bar that moves with the scroll: a page whose lines rise, the bar going up with them and coming back as soon as they sink a little.+ At rest the picture shows the bar half way back, over lines that have scrolled. */.gp-bar{background:radial-gradient(80% 90% at 50% 100%,#12162a,#08080a 72%)}-.tb-frame{position:absolute;left:14cqw;right:14cqw;top:21cqh;bottom:-8cqh;border-radius:2.2cqw 2.2cqw 0 0;overflow:hidden;background:#0f121b;border:1px solid #262c3d}-.tb-page{position:absolute;left:7cqw;right:7cqw;top:21cqh;display:flex;flex-direction:column;gap:3.4cqh;transform:translateY(-6cqh)}+.tb-frame{position:absolute;left:14cqw;right:14cqw;top:21cqh;bottom:-8cqh;border-radius:2.2cqw 2.2cqw 0 0;overflow:hidden;background:#0b0b0f;border:1px solid #262c3d}+.tb-page{position:absolute;left:7cqw;right:7cqw;top:20cqh;display:flex;flex-direction:column;gap:3.4cqh;transform:translateY(-30.5cqh)}.tb-page i{position:static;height:3cqh;border-radius:1cqh;background:#2a3042}-.tb-page i:nth-child(4n+2){width:86%}-.tb-page i:nth-child(4n+3){width:72%}-.tb-page i:nth-child(4n){width:92%}-.tb-page .im{height:15cqh;border-radius:1.6cqh;background:linear-gradient(135deg,rgba(110,168,255,.45),rgba(63,214,196,.3))}-.tb-bar{position:absolute;left:0;right:0;top:0;height:15cqh;background:#1a1e2a;border-bottom:1px solid #2c3243}+.tb-page .k{width:22%;height:2cqh;background:var(--c1);opacity:.85}+.tb-page .h{width:88%;height:5cqh;background:#d9dcea;opacity:.8}+.tb-page .s{width:58%}+.tb-page .au{display:flex;align-items:center;gap:2cqw;height:4.4cqw;background:none}+.tb-page .au b{display:block;flex:none;width:4.4cqw;height:4.4cqw;border-radius:50%;background:linear-gradient(135deg,var(--c4),var(--c5))}+.tb-page .au b+b{width:24cqw;height:1.8cqh;border-radius:1cqh;background:#3a4258}+.tb-page .im{height:15cqh;border-radius:1.6cqh;background:radial-gradient(circle at 76% 34%,#ffe9b8 0 6%,rgba(255,206,90,.45) 6.5%,transparent 20%),linear-gradient(160deg,#27407f,#5a3a99 58%,#8a3d6a)}+.tb-page .im~i:nth-child(4n+2){width:92%}+.tb-page .im~i:nth-child(4n+3){width:84%}+.tb-page .im~i:nth-child(4n){width:96%}+.tb-page .im~i:nth-child(4n+1){width:70%}+.tb-bar{position:absolute;left:0;right:0;top:0;height:15cqh;background:#151823;border-bottom:1px solid #2a2f40;transform:translateY(-7.5cqh)}.tb-bar i{top:50%}-.tb-bar .d{left:5cqw;width:4.4cqw;height:4.4cqw;margin-top:-2.2cqw;border-radius:50%;background:var(--c1)}-.tb-bar .t{left:12cqw;width:22cqw;height:2cqw;margin-top:-1cqw;border-radius:1cqw;background:#5d6580}-.tb-bar .m{right:5cqw;width:4.6cqw;height:3.2cqw;margin-top:-1.6cqw;background:linear-gradient(#5d6580 0 .7cqw,transparent .7cqw 1.25cqw,#5d6580 1.25cqw 1.95cqw,transparent 1.95cqw 2.5cqw,#5d6580 2.5cqw)}+.tb-bar .d{left:5cqw;width:4.4cqw;height:4.4cqw;margin-top:-2.2cqw;border-radius:50%;background:linear-gradient(135deg,var(--c1),var(--c3))}+.tb-bar .t{left:11.5cqw;width:15cqw;height:1.8cqh;margin-top:-.9cqh;border-radius:1cqh;background:#e9ebf3;opacity:.75}+.tb-bar .a{right:11.2cqw;width:3.6cqw;height:3.6cqw;margin-top:-1.8cqw;border-radius:50%;box-shadow:inset 0 0 0 .5cqw #5d6580}+.tb-bar .f{right:5cqw;width:3.6cqw;height:3.6cqw;margin-top:-1.8cqw;border-radius:50%;background:var(--c1)}@keyframes g-rib{from{transform:rotate(-20deg) translateY(-12%) scaleY(.6)}to{transform:rotate(-6deg) translateY(12%) scaleY(1.2)}}@keyframes g-sway{from{transform:rotate(-17deg) scale(1.2)}to{transform:rotate(-8deg) scale(1.2)}}@@ -450,8 +459,8 @@ button{font:inherit;color:inherit}@keyframes g-lit{0%,26%{opacity:0}36%,92%{opacity:var(--lit)}100%{opacity:0}}@keyframes g-sort{0%,26%{opacity:1;transform:none}36%,62%{opacity:var(--dim);transform:none}72%,92%{opacity:var(--dim);transform:translateX(var(--sx))}100%{opacity:1;transform:none}}@keyframes g-mark{0%,26%{transform:none}36%,62%{transform:translateY(6cqw)}72%,92%{transform:translateY(12cqw)}100%{transform:none}}-@keyframes g-page{0%,10%{transform:translateY(-6cqh)}38%,56%{transform:translateY(-40cqh)}70%,92%{transform:translateY(-32cqh)}100%{transform:translateY(-6cqh)}}-@keyframes g-slide{0%,14%{transform:none}24%,58%{transform:translateY(-105%)}68%,92%{transform:none}100%{transform:none}}+@keyframes g-page{0%{transform:translateY(0)}8%{transform:translateY(0)}10.67%{transform:translateY(-0.21cqh)}13.33%{transform:translateY(-1.67cqh)}16%{transform:translateY(-5.63cqh)}18.67%{transform:translateY(-13.34cqh)}21.33%{transform:translateY(-24.66cqh)}24%{transform:translateY(-32.37cqh)}26.67%{transform:translateY(-36.33cqh)}29.33%{transform:translateY(-37.79cqh)}32%{transform:translateY(-38cqh)}40%{transform:translateY(-38cqh)}41.33%{transform:translateY(-37.91cqh)}42.67%{transform:translateY(-37.25cqh)}44%{transform:translateY(-35.48cqh)}45.33%{transform:translateY(-32.03cqh)}46.67%{transform:translateY(-26.97cqh)}48%{transform:translateY(-23.52cqh)}49.33%{transform:translateY(-21.75cqh)}50.67%{transform:translateY(-21.09cqh)}52%{transform:translateY(-21cqh)}82%{transform:translateY(-21cqh)}83.56%{transform:translateY(-20.88cqh)}85.11%{transform:translateY(-20.08cqh)}86.67%{transform:translateY(-17.89cqh)}88.22%{transform:translateY(-13.63cqh)}89.78%{transform:translateY(-7.37cqh)}91.33%{transform:translateY(-3.11cqh)}92.89%{transform:translateY(-0.92cqh)}94.44%{transform:translateY(-0.12cqh)}96%{transform:translateY(0)}100%{transform:translateY(0)}}+@keyframes g-slide{0%{transform:translateY(0)}8%{transform:translateY(0)}10.67%{transform:translateY(-0.21cqh)}13.33%{transform:translateY(-1.67cqh)}16%{transform:translateY(-5.63cqh)}18.67%{transform:translateY(-13.34cqh)}21.33%{transform:translateY(-15cqh)}40%{transform:translateY(-15cqh)}41.33%{transform:translateY(-14.91cqh)}42.67%{transform:translateY(-14.25cqh)}44%{transform:translateY(-12.48cqh)}45.33%{transform:translateY(-9.03cqh)}46.67%{transform:translateY(-3.97cqh)}48%{transform:translateY(-0.52cqh)}49.33%{transform:translateY(0)}100%{transform:translateY(0)}}/* each loop starts part way in (--x), at a frame that shows the effect, so a tile that is not playing still shows it; the delays of theparts that follow one another (--d) are counted from there */@media(prefers-reduced-motion:no-preference){@@ -508,9 +517,9 @@ button{font:inherit;color:inherit}.gp-chart .g{animation:g-lit 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.gp-chart .bar{animation:g-sort 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}.gp-chart .mk{animation:g-mark 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}- .gp-bar{--x:.4s}- .tb-page{animation:g-page 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}- .tb-bar{animation:g-slide 7s var(--ease) infinite backwards;animation-delay:calc(0s - var(--x))}+ .gp-bar{--x:3.2s}+ .tb-page{animation:g-page 7s linear infinite backwards;animation-delay:calc(0s - var(--x))}+ .tb-bar{animation:g-slide 7s linear infinite backwards;animation-delay:calc(0s - var(--x))}}@media(max-width:960px){.fx-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:600px){@@ -871,12 +880,12 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n</li><li class="tile" data-fx-tile="medium-top-bar"><div class="t-stage">- <div class="gp gp-bar" aria-hidden="true"><div class="tb-frame"><div class="tb-page"><i class="im"></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i class="im"></i><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="tb-bar"><i class="d"></i><i class="t"></i><i class="m"></i></div></div></div>+ <div class="gp gp-bar" aria-hidden="true"><div class="tb-frame"><div class="tb-page"><i class="k"></i><i class="h"></i><i class="h s"></i><i class="au"><b></b><b></b></i><i class="im"></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="tb-bar"><i class="d"></i><i class="t"></i><i class="a"></i><i class="f"></i></div></div></div><div class="t-tags"><span class="t-tag">Our version</span><span class="t-tag t-start">On scroll</span></div></div><div class="t-meta"><h3 class="t-title"><a href="#medium-top-bar">The top bar that hides while you read</a></h3>- <p class="t-desc">Scroll down and the top bar slides away; scroll up and it comes back.</p>+ <p class="t-desc">Scroll down and the top bar rides up with the text; scroll up and it comes back.</p><p class="t-foot"><a class="t-site" href="https://medium.com/" target="_blank" rel="noopener">Seen on medium.com <span aria-hidden="true">↗</span><span class="sr"> (opens in a new tab)</span></a><span class="t-count">1 animation</span></p></div></li>@@ -1226,23 +1235,34 @@ html.fx-open{overflow:hidden;padding-right:var(--fx-gap,0px)} /* the page does n</section><section class="fx" id="medium-top-bar" aria-labelledby="medium-top-bar-t" data-fx-site="Medium" data-fx-start="scroll">- <p class="fx-seen">Seen on <a href="https://medium.com/" target="_blank" rel="noopener">medium.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-13">2026</time></p>+ <p class="fx-seen">Seen on <a href="https://medium.com/" target="_blank" rel="noopener">medium.com<span class="sr"> (opens in a new tab)</span></a> in <time datetime="2026-10-22">2026</time></p><h2 id="medium-top-bar-t" tabindex="-1">The top bar that hides while you read</h2><p class="fx-chips"><span class="fx-chip">Starts on scroll</span><span class="fx-chip">Made from 1 animation</span></p>+ <div class="fx-version">+ <div class="fx-stage">+ <iframe title="Our version: The top bar that hides while you read" data-src="versions/medium-top-bar.html"></iframe>+ <span class="fx-vlabel" aria-hidden="true">Our version</span>+ </div>+ <div class="fx-player">+ <button type="button" class="fx-pbtn" data-fx-cmd="play">Play</button>+ <button type="button" class="fx-pbtn" data-fx-cmd="top">Back to top</button>+ <p class="fx-phint">Built from the prompt below. Scroll inside the box, or press Play.</p>+ </div>+ </div><h3 class="fx-sub">What you see</h3>- <p class="fx-what">On a phone, scroll down into an article and the top bar moves up out of the way with the text; scroll up a little and it comes back down.</p>+ <p class="fx-what">On a phone, the top bar moves with your finger. Scroll down into an article and it rides up with the text until it is out of sight; scroll back up, even a little, and it slides down again by the same distance, fully back after a short scroll. On a wide screen the bar just stays where it is.</p><h3 class="fx-sub">Good to know</h3><dl class="fx-know">- <div><dt>Starts</dt><dd>Scrolling down hides the bar; scrolling up, even a little, brings it back.</dd></div>+ <div><dt>Starts</dt><dd>Scrolling down moves the bar out of sight; scrolling up brings it back by the same amount.</dd></div><div><dt>On phones</dt><dd>Touch scrolling works the same way.</dd></div>- <div><dt>Reduced motion</dt><dd>The bar fades out and in instead of sliding.</dd></div>+ <div><dt>Reduced motion</dt><dd>The bar fades out and in instead of moving.</dd></div></dl><h3 class="fx-sub">Build it with these animations</h3><div class="fx-cards"><article class="card c1" data-slug="hide-on-scroll-header"><div class="stage"><div class="pv" aria-hidden="true"></div><span class="tag">The whole effect</span></div><div class="meta"><h4 class="title"><a href="../animations/01-scroll-based/hide-on-scroll-header/">Hide-on-Scroll Header</a></h4><p class="desc">Scrolling down hides the top bar; scrolling up shows it. Best for mobile pages.</p></div></article></div><h3 class="fx-sub">A prompt to build something similar</h3>- <div class="fx-pbox"><p class="fx-prompt">Add a hide-on-scroll top bar to <mark>[the header of your article pages]</mark>. When the reader scrolls down into the text, slide the bar up out of view, so the words get the whole screen; the moment they scroll up, even a little, slide it back. Always show it near the top of the page. Tell the direction by comparing each scroll position with the last one, ignore tiny moves so the bar never flickers, and move it only with a transform. Touch scrolling works the same way, and keyboard focus moving into the bar brings it back. If the visitor has reduced motion turned on, fade the bar out and in instead of sliding it.</p></div>+ <div class="fx-pbox"><p class="fx-prompt">Add a top bar that moves with the scroll to <mark>[the header of your article pages]</mark>. Scrolling down, move the bar up by exactly as far as the page moved, until it is out of sight; the moment the reader scrolls up, move it back down by the same amount, so a short scroll brings it fully back. Do this on every scroll step, not after scrolling stops, and never past fully hidden or fully shown. Move it without pushing the text around. Touch scrolling works the same way, and keyboard focus moving into the bar brings it back. If the visitor has reduced motion turned on, fade the bar out and in instead of moving it.</p></div><button type="button" class="copy" aria-label="Copy prompt for The top bar that hides while you read"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg><span class="copy-l" aria-live="polite">Copy prompt</span></button><a class="fx-real" href="https://medium.com/" target="_blank" rel="noopener">Watch the real one on medium.com <span aria-hidden="true">↗</span><span class="sr"> (opens in a new tab)</span></a></section>diff --git a/famous/versions/medium-top-bar.html b/famous/versions/medium-top-bar.htmlnew file mode 100644index 00000000..7dfe3b25--- /dev/null+++ b/famous/versions/medium-top-bar.html@@ -0,0 +1,157 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<meta name="robots" content="noindex">+<title>Our version: The top bar that hides while you read</title>+<style>+@font-face{font-family:'Schibsted Grotesk';src:url('../../assets/fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-display:swap;unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}+@font-face{font-family:'Schibsted Grotesk';src:url('../../assets/fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}+:root{--bg:#0b0b0f;--ink:#f4f4f2;--text:#c3c4d0;--mut:#a3a4b4;--c1:#6ea8ff;--c3:#b98cff;--c4:#ff9d5c;--c5:#ff6f8b;--bh:clamp(48px,15vh,56px);--col:680px;--lx:16px;--cw:min(var(--col),calc(100% - 2 * var(--lx)));color-scheme:dark}+.framed{--lx:112px} /* inside the pop-up the page's "Our version" label sits over the top left corner, so the bar's mark (and the text, from 600px wide) starts after it */+@media(max-width:599px){.framed{--cw:min(var(--col),calc(100% - 32px))}}+.framed::after{content:"";position:fixed;left:0;top:0;width:150px;height:60px;z-index:2;pointer-events:none;background:radial-gradient(150px 60px at 0 0,var(--bg) 56%,#0b0b0f00)} /* text passing the label fades out around it */+*{box-sizing:border-box;margin:0}+html{background:var(--bg);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#3c3c4a var(--bg)}+body{color:var(--text);font:400 clamp(16px,.35vw + 14.6px,18px)/1.7 'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;-webkit-font-smoothing:antialiased}++/* the bar sits at the top of the page and is moved only by the scroll: up with the text going down, down with the text going up */+.bar{position:sticky;top:0;z-index:3;height:var(--bh);background:#151823;border-bottom:1px solid #2a2f40;will-change:transform}+.bar.ease{transition:transform .25s cubic-bezier(.2,.7,.3,1)} /* only when keyboard focus calls it back */+.in{display:flex;align-items:center;justify-content:space-between;gap:8px;height:100%;padding:0 max(0px,calc((100% - var(--cw)) / 2 - 8px)) 0 max(var(--lx),calc((100% - var(--cw)) / 2))}+.brand{display:flex;align-items:center;gap:6px;min-width:0;font-size:14px;font-weight:700;letter-spacing:-.01em;white-space:nowrap;color:var(--ink)}+.mark{flex:none;width:22px;height:22px;border-radius:50%;background:linear-gradient(135deg,var(--c1),var(--c3))}+.acts{display:flex;flex:none}+.btn{position:relative;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:none;color:#e9ebf3;cursor:pointer;-webkit-tap-highlight-color:transparent}+.btn::before{content:"";position:absolute;inset:4px;border-radius:50%;background:rgba(255,255,255,.07);box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);transition:background .15s}+.btn svg{position:relative;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}+.b2{color:#0b0b0f}+.b2::before{background:var(--c1);box-shadow:none}+.btn:focus-visible{outline:3px solid #fff;outline-offset:-3px}+@media(hover:hover){.btn:hover::before{background:rgba(255,255,255,.16)}.b2:hover::before{background:#8fbcff}}+@media(min-width:600px){.brand{gap:10px;font-size:16px}.mark{width:26px;height:26px}}+@media(max-width:308px){.framed .b1{display:none}}++.art{width:var(--cw);margin:0 auto;padding:clamp(22px,5vh,38px) 0 clamp(56px,12vh,96px)}+.kick{font-size:13px;line-height:1.3;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--c1)}+h1{margin-top:10px;font-size:clamp(26px,3vw + 14px,42px);line-height:1.12;font-weight:800;letter-spacing:-.025em;color:var(--ink);text-wrap:balance}+h2{margin:1.6em 0 .4em;font-size:clamp(20px,1.2vw + 15px,25px);line-height:1.25;font-weight:700;letter-spacing:-.015em;color:var(--ink);text-wrap:balance}+.by{display:flex;align-items:center;gap:12px;margin:18px 0 24px;font-size:14px;line-height:1.3;color:var(--mut)}+.av{flex:none;width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,var(--c4),var(--c5))}+.by b{display:block;font-size:15px;color:var(--ink)}+.cover{aspect-ratio:16/7;border-radius:14px;background:radial-gradient(circle at 76% 34%,#ffe9b8 0 5%,rgba(255,206,90,.5) 5.5%,transparent 17%),linear-gradient(160deg,#27407f,#5a3a99 58%,#8a3d6a)}+p{text-wrap:pretty}+.art p+p{margin-top:1em}+@media(max-width:599px){.x{display:none}} /* a shorter article on phones, so Play is not a blur */++/* reduced motion: the bar does not move; it fades out going down and back in going up (its buttons stay in the tab order, and focusing one brings it back) */+@media(prefers-reduced-motion:reduce){+ .bar{will-change:auto;transition:opacity .3s linear}+ .bar.away{opacity:0;pointer-events:none}+}+</style>+<script>document.documentElement.classList.toggle('framed', parent !== window);</script>+</head>+<body>+<header class="bar"><div class="in">+ <p class="brand"><i class="mark" aria-hidden="true"></i><span>Your logo</span></p>+ <div class="acts">+ <button type="button" class="btn b1" aria-label="Search"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="m16 16 4.5 4.5"/></svg></button>+ <button type="button" class="btn b2" aria-label="Save"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4.5h10a1 1 0 0 1 1 1V20l-6-4-6 4V5.5a1 1 0 0 1 1-1z"/></svg></button>+ </div>+</div></header>+<main class="art">+ <p class="kick">Everyday habits</p>+ <h1>Five small habits for a slower morning</h1>+ <div class="by"><i class="av" aria-hidden="true"></i><p><b>Written by Sam Ellery</b>5 min read</p></div>+ <div class="cover" aria-hidden="true"></div>+ <h2>Start with a glass of water</h2>+ <p>Most mornings start in a rush. The alarm goes off, the phone lights up, and the day is already asking for answers before the kettle has boiled. A glass of water changes the pace. It tells the body the day has begun, and it gives your hands something to do while your head catches up.</p>+ <h2>Open a window</h2>+ <p>Fresh air and a little daylight wake you more gently than a bright screen does. If the weather is bad, stand near the glass for a minute and watch the street come to life.</p>+ <h2>Leave the phone alone</h2>+ <p>Keep it in another room, or at least face down. Most of what waits there can wait another half hour. When the first thing you read is your own thoughts, the morning feels longer and calmer.</p>+ <p class="x">If the phone is your alarm, a cheap clock will do the same job and remove the best excuse for picking it up.</p>+ <h2>Make one small thing</h2>+ <p>Boil an egg, brew tea or fold the laundry. A small task with a clear end gives an early feeling of progress, and that feeling carries into harder work later. The goal is not to be productive. It is to begin without a fight.</p>+ <h2 class="x">Go outside for ten minutes</h2>+ <p class="x">A short walk around the block does more than most people expect. At an easy pace, ten minutes loosens the shoulders and clears the head. Stretching in the kitchen works too, on days when the weather wins.</p>+ <h2>Keep what helps</h2>+ <p>None of this has to be done perfectly, or every day. Some mornings will still be rushed. After a week, look back and keep the habits that helped. A good morning is not a strict routine. It is a few calm minutes that belong to you, set aside before everyone else asks for your time.</p>+</main>+<script>+const bar = document.querySelector('.bar'), reduce = matchMedia('(prefers-reduced-motion: reduce)'), FRAME = 1000 / 60;+const UP = 130, REST = 700; // when the run reaches the end it rests 0.7 s with the bar away, then goes 130px back up, slowly enough to see the bar return+let H = 56, END = 0, lastY = 0, ty = 0, away = false, anchor = 0, shown = '';+let rm = reduce.matches; // kept by the change listener below: a scroll handler never reads the query itself+let raf = 0, lastT = null, run = null, acted = false;++function draw() {+ const t = rm || !ty ? '' : `translate3d(0,${ty.toFixed(2)}px,0)`;+ if (t !== shown) bar.style.transform = shown = t;+ bar.classList.toggle('away', rm && away);+}+function measure() { H = Math.ceil(bar.getBoundingClientRect().height) || 56; END = Math.max(0, document.documentElement.scrollHeight - innerHeight); ty = Math.max(ty, -H); }++// On every scroll step, in the same frame: the bar moves by exactly as far as the page did, held between fully away and fully in place.+// Reduced motion: a move of 6px or more decides whether the bar is faded out (going down) or in (going up); at the very top it shows.+function follow() {+ const y = Math.min(Math.max(scrollY, 0), END), dy = y - lastY;+ lastY = y;+ if (!rm) ty = Math.min(0, Math.max(-H, ty - dy));+ else if (y < 2) { away = false; anchor = y; }+ else if (Math.abs(y - anchor) >= 6) { away = y > anchor; anchor = y; }+ draw();+}++function tick(ts) {+ raf = 0;+ const dt = lastT === null ? 0 : Math.min(ts - lastT, 50);+ lastT = ts;+ if (run) {+ if (Math.abs(scrollY - run.pos) > 3) run = null; // the visitor moved the page+ else if (run.rest === null) { run.t += dt; run.pos = Math.min(END, run.pos + END / 360 * (dt / FRAME) * Math.min(1, run.t / 450)); if (run.pos >= END) { run.rest = REST; run.floor = Math.max(0, END - UP); } } // about 6 s down, easing in so the bar's leaving is seen+ else if (run.rest > 0) run.rest -= dt;+ else { run.pos = Math.max(run.floor, run.pos - 2.2 * (dt / FRAME)); if (run.pos <= run.floor) { scrollTo({ top: run.floor, behavior: 'instant' }); follow(); run = null; } }+ if (run) { scrollTo({ top: run.pos, behavior: 'instant' }); follow(); }+ }+ if (run) raf = requestAnimationFrame(tick); else lastT = null;+}+const wake = () => { if (!raf) raf = requestAnimationFrame(tick); };+function play() {+ measure();+ if (END <= 0) return;+ if (scrollY >= END - UP - 4) { scrollTo({ top: 0, behavior: 'instant' }); follow(); } // already at the end: start from the top+ run = { pos: scrollY, rest: null, floor: 0, t: 0 }; lastT = null; wake();+}+function toTop() { run = null; scrollTo({ top: 0, behavior: 'instant' }); follow(); } // the bar is shown at once++addEventListener('message', e => {+ if (e.source !== parent || !e.data) return;+ if (e.data.fx === 'play') { acted = true; play(); } else if (e.data.fx === 'top') { acted = true; toTop(); }+});+['wheel', 'touchstart', 'pointerdown', 'keydown'].forEach(t => addEventListener(t, e => { if (e.isTrusted) { acted = true; run = null; } }, { passive: true, capture: true }));+addEventListener('scroll', follow, { passive: true });+addEventListener('resize', () => { measure(); follow(); });+document.addEventListener('visibilitychange', () => { lastT = null; });+bar.addEventListener('focusin', () => { // keyboard focus moving into the bar brings it back+ if (rm) away = false;+ else if (ty < 0) { bar.classList.add('ease'); ty = 0; setTimeout(() => bar.classList.remove('ease'), 300); }+ anchor = lastY; draw();+});+reduce.addEventListener('change', e => { // never half way: the bar settles shown or away+ rm = e.matches;+ if (rm) away = ty < -H / 2; else ty = away ? -H : 0;+ anchor = lastY; draw();+});++measure(); lastY = Math.min(scrollY, END); ty = -Math.min(lastY, H); away = lastY > 2; anchor = lastY; draw();+if (document.fonts) document.fonts.ready.then(() => { measure(); follow(); }); // the text may change height once the font is in+addEventListener('load', () => {+ measure(); follow();+ setTimeout(() => { if (!acted && !rm && scrollY < 2) play(); }, 700);+});+</script>+</body>+</html>diff --git a/tests/famous.test.js b/tests/famous.test.jsindex d59efbcd..90985859 100644--- a/tests/famous.test.js+++ b/tests/famous.test.js@@ -489,7 +489,7 @@ const SITE_PHRASES = [const CHECKED_IDS = ['stripe-ribbon', 'apple-scroll', 'landonorris-reveal', 'linear-intro', 'apple-menu', 'wikipedia-previews', 'apple-sweep', 'spotify-cards', 'youtube-loading', 'pudding-chart', 'medium-top-bar'];const CHECKED_DAY = '2026-10-13';// Entries checked again on their site before the gallery release, and the day of that check.-const RECHECKED = { 'apple-menu': '2026-10-22', 'apple-scroll': '2026-10-22', 'apple-sweep': '2026-10-22', 'landonorris-reveal': '2026-10-22', 'linear-intro': '2026-10-22', 'pudding-chart': '2026-10-22', 'spotify-cards': '2026-10-22', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '2026-10-22', 'youtube-loading': '2026-10-22' };+const RECHECKED = { 'apple-menu': '2026-10-22', 'apple-scroll': '2026-10-22', 'apple-sweep': '2026-10-22', 'landonorris-reveal': '2026-10-22', 'linear-intro': '2026-10-22', 'pudding-chart': '2026-10-22', 'spotify-cards': '2026-10-22', 'stripe-ribbon': '2026-10-22', 'wikipedia-previews': '2026-10-22', 'youtube-loading': '2026-10-22', 'medium-top-bar': '2026-10-22' };// The text a visitor reads, with each tag ending a word (textOf above joins the end of one element to the start of the next, so a// slogan at the end of a card label would run into the card's name and go unseen).@@ -756,7 +756,7 @@ for (const e of VERSIONS) {});}-test('every entry has its own version', { todo: 'versions come one at a time' }, () => {+test('every entry has its own version', () => {for (const e of ENTRIES) {const m = e.body.match(/<iframe title="Our version: [^"]+" data-src="(versions\/[a-z0-9-]+\.html)"/);assert.ok(m, `${e.id} has no Our version block yet`);