Animated Icons in SVG: Interface, Weather and Success States
Updated 2026-10-16. 10 effects.
An animated icon is a small inline SVG whose strokes or parts move to show a state: a bell that rings, a cloud that drifts, a checkmark that draws itself after a form is sent. Write it as SVG in the page, animate transform, opacity and stroke-dashoffset, and give it a text label whenever it carries meaning.
Split these into two kinds before you paste one. Decorative icons repeat what a word next to them already says, so they are hidden from screen readers with aria-hidden. Status icons, such as a success check or a weather symbol shown without a caption, carry information and need a label or visible text, plus a polite live region when the state changes.
Motion should explain a change, then stop. A check draws once when a payment goes through; a sync arrow turns only while something is syncing; weather icons can idle slowly because they describe a condition that is still true. Everything here keeps a 24 pixel grid and round stroke ends so a set looks consistent when you mix them.
The menu icon that turns into a cross has its own large set in the hamburger collection, so it is not repeated here.
Compare them
| Effect | Built with | Size (gzipped) | Running cost | Browser support |
|---|---|---|---|---|
| Copy to Clipboard Icon That Turns Into a Check | CSS and a small script | 2.2 KB | Two transitions per click on a single small SVG; nothing runs between clicks and no frame loop exists. | All current browsers |
| Document Toolbar Icons That Animate on Hover | CSS and a small script | 3.1 KB | Each icon moves one SVG group with a short keyframe; the small script only adds a class and pauses everything off screen. | All current browsers |
| File Sync Status Icons With Retry | CSS and a small script | 2.9 KB | One looping arrow, one spinner that runs only during a retry and a few one-off stroke draws; loops pause when the list is off screen. | All current browsers |
| Form Error and Warning Icons That Draw | CSS and a small script | 2.4 KB | Two small icons draw once and the field shifts sideways for under half a second; nothing loops. | All current browsers |
| Form Sent Envelope That Seals With a Check | CSS and a small script | 2.2 KB | A handful of SVG shapes animate transform, opacity and one dash offset for about a second and a half, then stop for good. | All current browsers |
| Opening Checklist That Ticks Off in Turn | CSS and a small script | 2.3 KB | Each row runs one fill, one stroke draw and one strike line once on entry; after that only the toggled row transitions. | All current browsers |
| Order Tracking Icons: Packed, On the Way, Delivered | CSS and a small script | 2.3 KB | Three icons and two connector fills animate once in sequence over about two seconds, then the card is static. | All current browsers |
| Payment Received Checkmark in a Circle | CSS and a small script | 2 KB | Four SVG shapes and four lines of text animate once for about a second and a half, then nothing runs at all. | All current browsers |
| Voice Note Microphone Icon With Level Bars | CSS and a small script | 2.6 KB | Eight bars scale on the compositor only while the recording state is on; a one second timer runs alongside and both pause off screen. | All current browsers |
| Weather Forecast Card With Animated Icons | CSS only | 2.5 KB | Six small SVG loops on transform, opacity and dash offset, paused by a tiny observer whenever the card leaves the screen or the tab hides. | All current browsers |
Copy to Clipboard Icon That Turns Into a Check
Copy buttons on a dark command panel in a docs page. Press one and the two-sheet clipboard icon shrinks and fades while a mint check draws in on the same spot, the word changes to Copied, and after two seconds both slip back. The icon is not morphed point by point: two finished shapes simply crossfade, which works in every browser.
<section class="m3cpy" aria-labelledby="m3cpy-h">
<div class="m3cpy-card">
<p class="m3cpy-kicker">Quarry Notes docs</p>
<h2 class="m3cpy-title" id="m3cpy-h">Set up the notes server</h2>
<p class="m3cpy-sub">Run these two lines in a terminal inside your project folder.</p>
<ol class="m3cpy-steps">
<li>
<span class="m3cpy-step">1. Install</span>
<div class="m3cpy-code"><code>npm install quarry-notes</code>
<button class="m3cpy-btn" type="button" aria-label="Copy install command">
<svg class="m3cpy-ic" viewBox="0 0 24 24" aria-hidden="true">
<g class="m3cpy-clip"><rect x="8" y="8" width="11.5" height="12.5" rx="2.2"/><path d="M15.5 8V5.7a2.2 2.2 0 0 0-2.2-2.2H6.7a2.2 2.2 0 0 0-2.2 2.2v8.6a2.2 2.2 0 0 0 2.2 2.2H8"/></g>
<path class="m3cpy-check" pathLength="1" d="M5.5 12.5l4.2 4.2 8.8-9"/>
</svg>
<span class="m3cpy-word">Copy</span>
</button>
</div>
</li>
<li>
<span class="m3cpy-step">2. Start</span>
<div class="m3cpy-code"><code>npx quarry-notes serve --port 4310</code>
<button class="m3cpy-btn" type="button" aria-label="Copy start command">
<svg class="m3cpy-ic" viewBox="0 0 24 24" aria-hidden="true">
<g class="m3cpy-clip"><rect x="8" y="8" width="11.5" height="12.5" rx="2.2"/><path d="M15.5 8V5.7a2.2 2.2 0 0 0-2.2-2.2H6.7a2.2 2.2 0 0 0-2.2 2.2v8.6a2.2 2.2 0 0 0 2.2 2.2H8"/></g>
<path class="m3cpy-check" pathLength="1" d="M5.5 12.5l4.2 4.2 8.8-9"/>
</svg>
<span class="m3cpy-word">Copy</span>
</button>
</div>
</li>
</ol>
<p class="m3cpy-live" role="status"></p>
</div>
</section>
<style>
/* Change these: page colour, code panel, text, accent for the check, how long "Copied" stays (also HOLD in the script). */
.m3cpy { --m3cpy-bg: #e4e2dd; --m3cpy-card: #fbfaf7; --m3cpy-code: #1d2025; --m3cpy-ink: #202326; --m3cpy-accent: #7fd1a8; }
.m3cpy { background: var(--m3cpy-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3cpy-ink); }
.m3cpy-card { max-width: 600px; margin: 0 auto; background: var(--m3cpy-card); border: 1px solid #dcd8d0; border-radius: 20px; padding: 28px; box-shadow: 0 1px 2px rgba(32,35,38,.05), 0 22px 44px -28px rgba(32,35,38,.4); }
.m3cpy-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #5a5f66; }
.m3cpy-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.m3cpy-sub { margin: 6px 0 0; font-size: 15px; color: #565b62; }
.m3cpy-steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.m3cpy-steps li { min-width: 0; }
.m3cpy-step { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #4b5057; }
.m3cpy-code { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--m3cpy-code); color: #e9e6df; }
.m3cpy-code code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.m3cpy-btn { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 40px; min-width: 96px; padding: 0 12px; border: 1px solid rgba(233,230,223,.16); border-radius: 9px; background: rgba(233,230,223,.06); color: #e9e6df; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background-color .2s ease, border-color .2s ease; }
.m3cpy-btn:hover { background: rgba(233,230,223,.12); }
.m3cpy-btn:focus-visible { outline: 2px solid var(--m3cpy-accent); outline-offset: 2px; }
.m3cpy-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3cpy-ic * { transform-box: fill-box; transform-origin: 50% 50%; }
/* The crossfade: clipboard shrinks away while the check draws in its place. */
.m3cpy-clip { transition: opacity .2s ease, transform .25s ease; }
.m3cpy-check { stroke: var(--m3cpy-accent); stroke-width: 2.2; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset .35s ease-out, opacity .15s ease; }
.m3cpy-btn.is-done { border-color: rgba(127,209,168,.4); }
.m3cpy-btn.is-done .m3cpy-clip { opacity: 0; transform: scale(.7); }
.m3cpy-btn.is-done .m3cpy-check { opacity: 1; stroke-dashoffset: 0; transition-delay: .1s, .08s; }
.m3cpy-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 480px) { .m3cpy-card { padding: 22px 16px; } .m3cpy-btn { min-width: 0; } .m3cpy-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
@media (prefers-reduced-motion: reduce) { .m3cpy * { transition: none !important; } }
</style>
<script>
(function () {
/* Change these: how long the check stays (ms), the words. */
var HOLD = 2000, DONE = "Copied", IDLE = "Copy";
var root = document.querySelector(".m3cpy");
if (!root) return;
var live = root.querySelector(".m3cpy-live"), btns = [].slice.call(root.querySelectorAll(".m3cpy-btn"));
function mark(b, say) {
b.classList.add("is-done"); b.querySelector(".m3cpy-word").textContent = DONE;
if (say) live.textContent = "Command copied";
clearTimeout(b._t);
b._t = setTimeout(function () { b.classList.remove("is-done"); b.querySelector(".m3cpy-word").textContent = IDLE; live.textContent = ""; }, HOLD);
}
btns.forEach(function (b) {
b.addEventListener("click", function () {
clearTimeout(demo);
var text = b.parentNode.querySelector("code").textContent;
if (navigator.clipboard) navigator.clipboard.writeText(text).then(function () { mark(b, true); }, function () { live.textContent = "Copy failed, select the text instead"; });
});
});
/* Preview only: shows the copied state once without touching the clipboard. Delete for real use. */
var demo = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : setTimeout(function () { mark(btns[0], false); }, 1000);
root.addEventListener("focusin", function () { clearTimeout(demo); });
})();
</script>
With reduced motion: The clipboard swaps for the check and the label changes to Copied in one step, with no fade or drawing.
Running cost: Two transitions per click on a single small SVG; nothing runs between clicks and no frame loop exists.
- Change `HOLD` for how long the check stays before the button resets.
- Recolour the check with `--m3cpy-accent` and the panel with `--m3cpy-code`.
- Add more commands by copying an `<li>`; each button copies the text of the `<code>` beside it.
Document Toolbar Icons That Animate on Hover
Eight line icons in an editing toolbar for a catalogue draft, each with its own small gesture: the bell swings from its hook, the sync arrows make half a turn, the bin lid tips open, the plane flies out and back. Hover, keyboard focus and a tap all play it, and a slow idle cycle shows the set before anyone touches it.
<section class="m3tlb" aria-labelledby="m3tlb-h">
<div class="m3tlb-card">
<div class="m3tlb-head">
<div>
<p class="m3tlb-kicker">Fernway Studio</p>
<h2 class="m3tlb-title" id="m3tlb-h">Spring catalogue, draft 3</h2>
</div>
<p class="m3tlb-meta">Edited by Ines Calder</p>
</div>
<div class="m3tlb-bar" role="toolbar" aria-label="Document actions">
<button class="m3tlb-btn" type="button" data-a="bell">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-bell"><path d="M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 1.5h-15z"/><path class="m3tlb-clap" d="M10 20.5a2 2 0 0 0 4 0"/></g></svg></span>
<span>Alerts</span>
</button>
<button class="m3tlb-btn" type="button" data-a="sync">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-sync"><path d="M19.5 12a7.5 7.5 0 0 1-13.4 4.6"/><path d="M4.5 12a7.5 7.5 0 0 1 13.4-4.6"/><path d="M18.4 3.8v3.9h-3.9"/><path d="M5.6 20.2v-3.9h3.9"/></g></svg></span>
<span>Sync</span>
</button>
<button class="m3tlb-btn" type="button" data-a="trash">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-lid"><path d="M4 7h16"/><path d="M9.5 7V4.5h5V7"/></g><path d="M6.5 7l.9 12.5h9.2l.9-12.5"/><path d="M10.2 11v5.5M13.8 11v5.5"/></svg></span>
<span>Delete</span>
</button>
<button class="m3tlb-btn" type="button" data-a="send">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-plane"><path d="M20.5 3.5L10 14"/><path d="M20.5 3.5l-6.6 17-3.9-6.5-6.5-3.9z"/></g></svg></span>
<span>Send</span>
</button>
<button class="m3tlb-btn" type="button" data-a="down">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-arrow"><path d="M12 3.5v11"/><path d="M7.5 10l4.5 4.5 4.5-4.5"/></g><path d="M5 19.5h14"/></svg></span>
<span>Download</span>
</button>
<button class="m3tlb-btn" type="button" data-a="heart" aria-pressed="false">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-heart"><path class="m3tlb-fill" d="M12 19.5s-7-4.3-7-9.6A3.9 3.9 0 0 1 12 7.6a3.9 3.9 0 0 1 7 2.3c0 5.3-7 9.6-7 9.6z"/><path d="M12 19.5s-7-4.3-7-9.6A3.9 3.9 0 0 1 12 7.6a3.9 3.9 0 0 1 7 2.3c0 5.3-7 9.6-7 9.6z"/></g></svg></span>
<span>Favourite</span>
</button>
<button class="m3tlb-btn" type="button" data-a="find">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3tlb-lens"><circle cx="10.5" cy="10.5" r="6"/><path d="M15 15l4.5 4.5"/></g></svg></span>
<span>Search</span>
</button>
<button class="m3tlb-btn" type="button" data-a="lock">
<span class="m3tlb-tile"><svg class="m3tlb-ic" viewBox="0 0 24 24" aria-hidden="true"><path class="m3tlb-shackle" d="M8 11V8a4 4 0 0 1 8 0v3"/><rect x="5" y="11" width="14" height="9.5" rx="2.2"/><path d="M12 14.8v2"/></svg></span>
<span>Lock</span>
</button>
</div>
<p class="m3tlb-foot">Hover, focus or tap an action to see its icon move.</p>
</div>
</section>
<style>
/* Change these: page colour, card, ink, accent, icon stroke weight. */
.m3tlb { --m3tlb-bg: #eceee9; --m3tlb-card: #fbfbf8; --m3tlb-ink: #1e2622; --m3tlb-accent: #2f6a55; --m3tlb-stroke: 1.75; }
.m3tlb { background: var(--m3tlb-bg); padding: 72px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3tlb-ink); }
.m3tlb-card { max-width: 760px; margin: 0 auto; background: var(--m3tlb-card); border: 1px solid #dfe2dc; border-radius: 20px; padding: 28px; box-shadow: 0 1px 2px rgba(30,38,34,.05), 0 18px 40px -24px rgba(30,38,34,.28); }
.m3tlb-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 24px; padding-bottom: 22px; border-bottom: 1px solid #e7e9e3; }
.m3tlb-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--m3tlb-accent); }
.m3tlb-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.m3tlb-meta { margin: 0; font-size: 14px; color: #55605a; }
.m3tlb-bar { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 22px; }
.m3tlb-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 92px; padding: 10px 4px 10px; border: 0; border-radius: 14px; background: transparent; color: var(--m3tlb-ink); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background-color .25s ease, color .25s ease; }
.m3tlb-btn:focus-visible { outline: 2px solid var(--m3tlb-accent); outline-offset: 2px; }
.m3tlb-btn.is-on, .m3tlb-btn:focus-visible { background: #edf3ee; color: var(--m3tlb-accent); }
.m3tlb-tile { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 1px solid #e3e6e0; box-shadow: 0 1px 1px rgba(30,38,34,.04), 0 4px 10px -6px rgba(30,38,34,.18); transition: border-color .25s ease; }
.m3tlb-btn.is-on .m3tlb-tile, .m3tlb-btn:focus-visible .m3tlb-tile { border-color: #b9cfc2; }
.m3tlb-ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: var(--m3tlb-stroke); stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3tlb-ic g, .m3tlb-ic path { transform-box: fill-box; }
.m3tlb-bell { transform-origin: 50% 0; }
.m3tlb-sync { transform-origin: 50% 50%; }
.m3tlb-lid { transform-origin: 0% 100%; }
.m3tlb-heart { transform-origin: 50% 60%; }
.m3tlb-lens { transform-origin: 50% 50%; }
.m3tlb-fill { fill: currentColor; stroke: none; opacity: 0; transition: opacity .3s ease; }
.m3tlb-btn[aria-pressed="true"] .m3tlb-fill { opacity: 1; }
.m3tlb-foot { margin: 18px 0 0; font-size: 13px; color: #5d6862; text-align: center; }
.m3tlb-btn.is-on .m3tlb-bell, .m3tlb-btn:focus-visible .m3tlb-bell { animation: m3tlb-swing .9s cubic-bezier(.36,.07,.19,.97); }
.m3tlb-btn.is-on .m3tlb-clap, .m3tlb-btn:focus-visible .m3tlb-clap { animation: m3tlb-clap .9s ease; }
.m3tlb-btn.is-on .m3tlb-sync, .m3tlb-btn:focus-visible .m3tlb-sync { animation: m3tlb-turn .8s cubic-bezier(.6,0,.3,1); }
.m3tlb-btn.is-on .m3tlb-lid, .m3tlb-btn:focus-visible .m3tlb-lid { animation: m3tlb-lid .8s ease; }
.m3tlb-btn.is-on .m3tlb-plane, .m3tlb-btn:focus-visible .m3tlb-plane { animation: m3tlb-fly .8s cubic-bezier(.5,0,.3,1); }
.m3tlb-btn.is-on .m3tlb-arrow, .m3tlb-btn:focus-visible .m3tlb-arrow { animation: m3tlb-drop .8s ease; }
.m3tlb-btn.is-on .m3tlb-heart, .m3tlb-btn:focus-visible .m3tlb-heart { animation: m3tlb-beat .7s ease; }
.m3tlb-btn.is-on .m3tlb-lens, .m3tlb-btn:focus-visible .m3tlb-lens { animation: m3tlb-scan .9s ease-in-out; }
.m3tlb-btn.is-on .m3tlb-shackle, .m3tlb-btn:focus-visible .m3tlb-shackle { animation: m3tlb-lift .8s ease; }
@media (hover: hover) {
.m3tlb-btn:hover { background: #eef2ee; }
.m3tlb-btn:hover .m3tlb-bell { animation: m3tlb-swing .9s cubic-bezier(.36,.07,.19,.97); }
.m3tlb-btn:hover .m3tlb-clap { animation: m3tlb-clap .9s ease; }
.m3tlb-btn:hover .m3tlb-sync { animation: m3tlb-turn .8s cubic-bezier(.6,0,.3,1); }
.m3tlb-btn:hover .m3tlb-lid { animation: m3tlb-lid .8s ease; }
.m3tlb-btn:hover .m3tlb-plane { animation: m3tlb-fly .8s cubic-bezier(.5,0,.3,1); }
.m3tlb-btn:hover .m3tlb-arrow { animation: m3tlb-drop .8s ease; }
.m3tlb-btn:hover .m3tlb-heart { animation: m3tlb-beat .7s ease; }
.m3tlb-btn:hover .m3tlb-lens { animation: m3tlb-scan .9s ease-in-out; }
.m3tlb-btn:hover .m3tlb-shackle { animation: m3tlb-lift .8s ease; }
}
@keyframes m3tlb-swing { 0%,100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-10deg); } 60% { transform: rotate(6deg); } 80% { transform: rotate(-3deg); } }
@keyframes m3tlb-clap { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-1.6px); } 45% { transform: translateX(1.4px); } 65% { transform: translateX(-.8px); } }
@keyframes m3tlb-turn { from { transform: rotate(0); } to { transform: rotate(180deg); } }
@keyframes m3tlb-lid { 0%,100% { transform: none; } 40%,60% { transform: translateY(-2px) rotate(-16deg); } }
@keyframes m3tlb-fly { 0% { transform: none; opacity: 1; } 45% { transform: translate(7px,-7px); opacity: 0; } 46% { transform: translate(-6px,6px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes m3tlb-drop { 0%,100% { transform: none; } 35% { transform: translateY(3px); } 55% { transform: translateY(-1px); } 75% { transform: translateY(1.5px); } }
@keyframes m3tlb-beat { 0%,100% { transform: scale(1); } 30% { transform: scale(1.16); } 55% { transform: scale(.96); } 75% { transform: scale(1.05); } }
@keyframes m3tlb-scan { 0%,100% { transform: none; } 30% { transform: translate(-1.5px,-1px) rotate(-8deg); } 65% { transform: translate(1.5px,-1px) rotate(8deg); } }
@keyframes m3tlb-lift { 0%,100% { transform: none; } 35%,65% { transform: translateY(-2.5px); } }
.m3tlb[data-off] * { animation-play-state: paused !important; }
@media (max-width: 640px) { .m3tlb-bar { grid-template-columns: repeat(4, 1fr); } .m3tlb-card { padding: 22px 16px; } }
@media (prefers-reduced-motion: reduce) { .m3tlb * { animation: none !important; } }
</style>
<script>
(function () {
/* Change these: idle demo step in ms, how long a tapped icon stays highlighted. */
var STEP = 1100, HOLD = 1050;
var root = document.querySelector(".m3tlb");
if (!root) return;
var btns = [].slice.call(root.querySelectorAll(".m3tlb-btn"));
var calm = matchMedia("(prefers-reduced-motion: reduce)").matches;
var i = 0, timer = 0, idle = !calm, seen = true;
function flash(b) {
b.classList.remove("is-on"); void b.offsetWidth; b.classList.add("is-on");
clearTimeout(b._t); b._t = setTimeout(function () { b.classList.remove("is-on"); }, HOLD);
}
btns.forEach(function (b) {
b.addEventListener("click", function () {
stopIdle();
if (b.hasAttribute("aria-pressed")) b.setAttribute("aria-pressed", String(b.getAttribute("aria-pressed") !== "true"));
flash(b);
});
});
function stopIdle() { idle = false; clearInterval(timer); timer = 0; }
function tick() { if (seen && !document.hidden) { flash(btns[i]); i = (i + 1) % btns.length; } }
root.addEventListener("pointerenter", function (e) { if (e.pointerType === "mouse") stopIdle(); });
root.addEventListener("focusin", stopIdle);
/* Pauses CSS motion and the demo while the toolbar is off screen. */
new IntersectionObserver(function (en) {
seen = en[0].isIntersecting;
if (seen) root.removeAttribute("data-off"); else root.setAttribute("data-off", "");
}).observe(root);
if (idle) { setTimeout(tick, 250); timer = setInterval(tick, STEP); }
})();
</script>
With reduced motion: Every icon stays still at rest and the button only changes its tint on hover, focus or tap.
Running cost: Each icon moves one SVG group with a short keyframe; the small script only adds a class and pauses everything off screen.
- Change `--m3tlb-accent` for the active tint and `--m3tlb-stroke` for the weight of every icon.
- Set `STEP` to slow the idle tour, or delete the `setInterval` line to turn it off.
- Each gesture is one keyframe such as `m3tlb-swing` or `m3tlb-lid`; soften the degrees there for a quieter set.
File Sync Status Icons With Retry
A shared folder list for a bakery where each file shows its state as an icon plus words: an arrow rising out of a tray while it uploads, a cloud whose check draws in once it has synced, a cloud struck through when offline, and a warning triangle that nudges once. Retry crossfades that last row to turning arrows, then to a fresh check.
<section class="m3sts" aria-labelledby="m3sts-h">
<div class="m3sts-card">
<div class="m3sts-head">
<div>
<p class="m3sts-kicker">Juniper Lane Bakery</p>
<h2 class="m3sts-title" id="m3sts-h">Shared folder: autumn menu</h2>
</div>
<button class="m3sts-replay" type="button">Replay</button>
</div>
<ul class="m3sts-list">
<li class="m3sts-row" data-s="up">
<svg class="m3sts-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 14.5v4h14v-4"/><g class="m3sts-arrow"><path d="M12 14V5"/><path d="M8.5 8.5L12 5l3.5 3.5"/></g></svg>
<div class="m3sts-text"><p class="m3sts-name">menu-photos (8 files)</p><p class="m3sts-txt">Uploading, 3 of 8 done</p></div>
</li>
<li class="m3sts-row" data-s="done">
<svg class="m3sts-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M7.5 19h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 12.1 3.5 3.5 0 0 0 7.5 19z"/><path class="m3sts-draw" pathLength="1" d="M9.4 14.6l1.9 1.9 3.4-3.6"/></svg>
<div class="m3sts-text"><p class="m3sts-name">price-cards.pdf</p><p class="m3sts-txt">Synced just now</p></div>
</li>
<li class="m3sts-row" data-s="off">
<svg class="m3sts-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M7.5 19h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 12.1 3.5 3.5 0 0 0 7.5 19z"/><path class="m3sts-draw m3sts-late" pathLength="1" d="M4 4.5l16 16"/></svg>
<div class="m3sts-text"><p class="m3sts-name">counter-sign.png</p><p class="m3sts-txt">Offline, syncs when you reconnect</p></div>
</li>
<li class="m3sts-row" data-s="err">
<svg class="m3sts-ic" viewBox="0 0 24 24" aria-hidden="true">
<g class="m3sts-g m3sts-g-err"><path d="M10.6 5.2a1.6 1.6 0 0 1 2.8 0l7 12.2a1.6 1.6 0 0 1-1.4 2.4H5a1.6 1.6 0 0 1-1.4-2.4z"/><path d="M12 10v3.6"/><path d="M12 16.6v.1"/></g>
<g class="m3sts-g m3sts-g-sync"><g class="m3sts-spin"><path d="M19 12a7 7 0 0 1-12.5 4.3"/><path d="M5 12a7 7 0 0 1 12.5-4.3"/><path d="M17.9 4.4v3.6h-3.6"/><path d="M6.1 19.6V16h3.6"/></g></g>
<g class="m3sts-g m3sts-g-done"><path d="M7.5 19h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 12.1 3.5 3.5 0 0 0 7.5 19z"/><path class="m3sts-tick" pathLength="1" d="M9.4 14.6l1.9 1.9 3.4-3.6"/></g>
</svg>
<div class="m3sts-text"><p class="m3sts-name">supplier-list.csv</p><p class="m3sts-txt">Could not upload: the file is open elsewhere</p></div>
<button class="m3sts-retry" type="button">Retry</button>
</li>
</ul>
<p class="m3sts-live" role="status"></p>
</div>
</section>
<style>
/* Change these: page, card, and the four state colours. */
.m3sts { --m3sts-bg: #e9edf1; --m3sts-card: #ffffff; --m3sts-up: #2f5f93; --m3sts-ok: #2b7350; --m3sts-off: #5d6672; --m3sts-err: #b4432c; }
.m3sts { background: var(--m3sts-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: #1c2430; }
.m3sts-card { max-width: 620px; margin: 0 auto; background: var(--m3sts-card); border: 1px solid #dde3ea; border-radius: 20px; padding: 26px; box-shadow: 0 1px 2px rgba(28,36,48,.05), 0 22px 44px -28px rgba(28,36,48,.35); }
.m3sts-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.m3sts-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #4f5a68; }
.m3sts-title { margin: 6px 0 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.m3sts-replay { min-height: 40px; padding: 0 14px; border: 1px solid #d3dae2; border-radius: 999px; background: #fff; color: #3a4552; font: inherit; font-size: 13px; cursor: pointer; }
.m3sts-list { list-style: none; margin: 20px 0 0; padding: 0; }
.m3sts-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid #edf0f4; }
.m3sts-ic { flex: none; width: 40px; height: 40px; padding: 8px; box-sizing: border-box; border-radius: 12px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3sts-ic g, .m3sts-ic path { transform-box: fill-box; transform-origin: 50% 50%; }
.m3sts-row[data-s="up"] .m3sts-ic { color: var(--m3sts-up); background: #e8eff7; }
.m3sts-row[data-s="done"] .m3sts-ic, .m3sts-row[data-s="ok"] .m3sts-ic { color: var(--m3sts-ok); background: #e6f2eb; }
.m3sts-row[data-s="off"] .m3sts-ic { color: var(--m3sts-off); background: #eef0f3; }
.m3sts-row[data-s="err"] .m3sts-ic { color: var(--m3sts-err); background: #f8e9e5; }
.m3sts-row[data-s="sync"] .m3sts-ic { color: var(--m3sts-up); background: #e8eff7; }
.m3sts-ic { transition: color .3s ease, background-color .3s ease; }
.m3sts-text { flex: 1; min-width: 0; }
.m3sts-name { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.m3sts-txt { margin: 3px 0 0; font-size: 13.5px; color: #4f5a68; }
.m3sts-retry { flex: none; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: #1c2430; color: #fff; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: opacity .25s ease; }
.m3sts-row:not([data-s="err"]) .m3sts-retry { opacity: 0; pointer-events: none; }
.m3sts-retry:focus-visible, .m3sts-replay:focus-visible { outline: 2px solid var(--m3sts-up); outline-offset: 3px; }
.m3sts-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Crossfade between the three icons of the retry row. */
.m3sts-g { opacity: 0; transition: opacity .3s ease; }
.m3sts-row[data-s="err"] .m3sts-g-err, .m3sts-row[data-s="sync"] .m3sts-g-sync, .m3sts-row[data-s="ok"] .m3sts-g-done { opacity: 1; }
.m3sts-draw, .m3sts-tick { stroke-dasharray: 1; stroke-dashoffset: 0; }
/* Motion: the arrow loops only while uploading; the sync arrows turn only while syncing; checks draw once. */
.m3sts-arrow { animation: m3sts-rise 1.8s ease-in-out infinite; }
.m3sts-row[data-s="sync"] .m3sts-spin { animation: m3sts-turn 1.1s linear infinite; }
.m3sts-row[data-s="ok"] .m3sts-tick { animation: m3sts-draw .5s .15s ease-out both; }
.m3sts[data-in] .m3sts-draw { animation: m3sts-draw .6s .2s ease-out both; }
.m3sts[data-in] .m3sts-late { animation-delay: .45s; }
.m3sts[data-in] .m3sts-row[data-s="err"] .m3sts-g-err { animation: m3sts-nudge .5s .7s ease-in-out both; }
@keyframes m3sts-rise { 0% { transform: translateY(2px); opacity: 0; } 30%,70% { opacity: 1; } 100% { transform: translateY(-2.5px); opacity: 0; } }
@keyframes m3sts-turn { to { transform: rotate(360deg); } }
@keyframes m3sts-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m3sts-nudge { 0%,100% { transform: none; } 25% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } 75% { transform: translateX(-.8px); } }
.m3sts[data-off] * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { .m3sts * { animation: none !important; transition: none !important; } }
</style>
<script>
(function () {
/* Change these: how long the retry spins before it reports success (ms), and the messages. */
var SPIN = 1800, DONE = "Uploaded just now", WAIT = "Uploading again";
var root = document.querySelector(".m3sts");
if (!root) return;
var row = root.querySelector('[data-s="err"]'), txt = row.querySelector(".m3sts-txt"), live = root.querySelector(".m3sts-live");
var first = txt.textContent, name = row.querySelector(".m3sts-name").textContent, t = 0;
function set(s, msg, say) { row.setAttribute("data-s", s); txt.textContent = msg; if (say) live.textContent = name + ": " + msg; }
function retry(say) {
set("sync", WAIT, say);
clearTimeout(t); t = setTimeout(function () { set("ok", DONE, say); }, SPIN);
}
row.querySelector(".m3sts-retry").addEventListener("click", function () { clearTimeout(demo); retry(true); });
/* Preview: one quiet retry shortly after load (not announced); delete this line for real use. */
var demo = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : setTimeout(function () { retry(false); }, 900);
root.addEventListener("focusin", function () { clearTimeout(demo); });
root.querySelector(".m3sts-replay").addEventListener("click", function () {
clearTimeout(t); clearTimeout(demo); set("err", first, false); live.textContent = "";
root.removeAttribute("data-in"); void root.offsetWidth; root.setAttribute("data-in", "");
});
/* Draws the checks the first time the card is seen, and pauses loops off screen. */
new IntersectionObserver(function (en) {
var on = en[0].isIntersecting;
if (on) { root.setAttribute("data-in", ""); root.removeAttribute("data-off"); } else root.setAttribute("data-off", "");
}).observe(root);
})();
</script>
With reduced motion: Each row shows its finished icon and text at once, and a retry swaps straight from the warning to the synced check.
Running cost: One looping arrow, one spinner that runs only during a retry and a few one-off stroke draws; loops pause when the list is off screen.
- Set the four state colours with `--m3sts-up`, `--m3sts-ok`, `--m3sts-off` and `--m3sts-err`.
- Change `SPIN` and the `DONE` and `WAIT` messages; in a real app call `set()` when your upload request settles instead of the timer.
- Delete the `demo` timeout line so the preview retry no longer runs by itself.
Form Error and Warning Icons That Draw
A rowing club signup form caught in an error. An amber notice above draws its warning triangle and drops in the exclamation mark, then the email field nudges sideways once and a red circle draws beside the message that explains what is missing. Fix the address and submit, and the circle swaps its mark for a quiet check.
<section class="m3wrn" aria-labelledby="m3wrn-h">
<form class="m3wrn-card" novalidate>
<div class="m3wrn-head">
<h2 class="m3wrn-title" id="m3wrn-h">Join the Tidewater Rowing Club list</h2>
<button class="m3wrn-replay" type="button">Replay</button>
</div>
<div class="m3wrn-banner">
<svg class="m3wrn-ic m3wrn-tri" viewBox="0 0 24 24" aria-hidden="true"><path class="m3wrn-draw" pathLength="1" d="M10.6 4.6a1.6 1.6 0 0 1 2.8 0l7.3 12.8a1.6 1.6 0 0 1-1.4 2.4H4.7a1.6 1.6 0 0 1-1.4-2.4z"/><path class="m3wrn-bar" d="M12 9.5v4"/><path class="m3wrn-dot" d="M12 16.6v.1"/></svg>
<p>Saturday sessions move to the north jetty from next week.</p>
</div>
<label class="m3wrn-label" for="m3wrn-email">Email address</label>
<div class="m3wrn-field">
<input class="m3wrn-input" id="m3wrn-email" type="email" value="maya.okafor@harbourline" aria-invalid="true" aria-describedby="m3wrn-err" autocomplete="email">
</div>
<p class="m3wrn-err" id="m3wrn-err">
<svg class="m3wrn-ic m3wrn-circ" viewBox="0 0 24 24" aria-hidden="true"><circle class="m3wrn-draw" pathLength="1" cx="12" cy="12" r="8.5"/><path class="m3wrn-bar" d="M12 7.8v4.6"/><path class="m3wrn-dot" d="M12 15.9v.1"/><path class="m3wrn-ok" d="M8.3 12.3l2.6 2.6 4.8-5"/></svg>
<span role="status">That address is missing its ending, such as .com or .org.</span>
</p>
<button class="m3wrn-submit" type="submit">Join the list</button>
</form>
</section>
<style>
/* Change these: page colour, card, ink, error red, warning amber. */
.m3wrn { --m3wrn-bg: #e8e6e2; --m3wrn-card: #fcfbf9; --m3wrn-ink: #1f2226; --m3wrn-err: #b02a1f; --m3wrn-warn: #8a5500; }
.m3wrn { background: var(--m3wrn-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3wrn-ink); }
.m3wrn-card { max-width: 460px; margin: 0 auto; background: var(--m3wrn-card); border: 1px solid #dedad3; border-radius: 20px; padding: 28px 26px; box-shadow: 0 1px 2px rgba(31,34,38,.05), 0 22px 44px -28px rgba(31,34,38,.4); }
.m3wrn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.m3wrn-title { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.m3wrn-replay { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid #d6d1c8; border-radius: 999px; background: #fff; color: #444a50; font: inherit; font-size: 13px; cursor: pointer; }
.m3wrn-banner { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: #fbf0d9; color: var(--m3wrn-warn); }
.m3wrn-banner p { margin: 1px 0 0; font-size: 14px; line-height: 1.45; color: #5e3d06; }
.m3wrn-ic { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3wrn-ic * { transform-box: fill-box; transform-origin: 50% 50%; }
.m3wrn-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.m3wrn-circ .m3wrn-draw { transform: rotate(-90deg); }
.m3wrn-dot { stroke-width: 2.4; }
.m3wrn-label { display: block; margin-top: 22px; font-size: 14px; font-weight: 600; }
.m3wrn-field { margin-top: 8px; }
.m3wrn-input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--m3wrn-err); border-radius: 12px; background: #fff; color: var(--m3wrn-ink); font: inherit; font-size: 15.5px; }
.m3wrn-input:focus-visible { outline: 3px solid rgba(176,42,31,.25); outline-offset: 1px; }
.m3wrn-err { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; color: var(--m3wrn-err); font-size: 14px; line-height: 1.45; }
.m3wrn-err .m3wrn-ic { width: 20px; height: 20px; }
.m3wrn-submit { margin-top: 22px; width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--m3wrn-ink); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.m3wrn-submit:focus-visible, .m3wrn-replay:focus-visible { outline: 2px solid var(--m3wrn-ink); outline-offset: 3px; }
.m3wrn-err.is-ok { color: #2b6a48; }
.m3wrn-ok { opacity: 0; transition: opacity .25s ease; }
.m3wrn-err.is-ok .m3wrn-ok { opacity: 1; }
.m3wrn-err.is-ok .m3wrn-bar, .m3wrn-err.is-ok .m3wrn-dot { opacity: 0; }
.m3wrn-input.is-ok { border-color: #2b6a48; }
/* Entrance: outlines draw, the bar and dot drop in, the field nudges once. Done by about 1.3 s. */
.m3wrn[data-play] .m3wrn-draw { animation: m3wrn-draw .55s ease-out both; }
.m3wrn[data-play] .m3wrn-bar { animation: m3wrn-drop .3s .45s ease-out both; }
.m3wrn[data-play] .m3wrn-dot { animation: m3wrn-fade .25s .65s ease-out both; }
.m3wrn[data-play] .m3wrn-err .m3wrn-draw { animation-delay: .35s; }
.m3wrn[data-play] .m3wrn-err .m3wrn-bar { animation-delay: .75s; }
.m3wrn[data-play] .m3wrn-err .m3wrn-dot { animation-delay: .95s; }
.m3wrn[data-play] .m3wrn-field { animation: m3wrn-nudge .45s .6s ease-in-out both; }
.m3wrn[data-play] .m3wrn-err span { animation: m3wrn-fade .35s .5s ease-out both; }
@keyframes m3wrn-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m3wrn-drop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes m3wrn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m3wrn-nudge { 0%,100% { transform: none; } 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }
@media (max-width: 480px) { .m3wrn-card { padding: 22px 18px; } }
@media (prefers-reduced-motion: reduce) { .m3wrn * { animation: none !important; } }
</style>
<script>
(function () {
/* Plays once in view; Replay plays again; submitting checks the address and updates the message. */
var root = document.querySelector(".m3wrn");
if (!root) return;
var input = root.querySelector(".m3wrn-input"), err = root.querySelector(".m3wrn-err"), msg = err.querySelector("span"), first = msg.textContent;
function play() { root.removeAttribute("data-play"); void root.offsetWidth; root.setAttribute("data-play", ""); }
function show(ok) {
input.setAttribute("aria-invalid", String(!ok)); input.classList.toggle("is-ok", ok); err.classList.toggle("is-ok", ok);
msg.textContent = ok ? "Looks good. You are on the list." : first;
if (!ok) play();
}
root.querySelector("form").addEventListener("submit", function (e) { e.preventDefault(); show(/^[^@\s]+@[^@\s]+\.[a-z]{2,}$/i.test(input.value.trim())); });
root.querySelector(".m3wrn-replay").addEventListener("click", function () { input.value = "maya.okafor@harbourline"; show(false); });
var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { play(); io.disconnect(); } });
io.observe(root);
})();
</script>
With reduced motion: The warning triangle, the error circle and both messages are drawn complete, and the field does not move.
Running cost: Two small icons draw once and the field shifts sideways for under half a second; nothing loops.
- Change `--m3wrn-err` and `--m3wrn-warn` to your own error and warning colours; keep 4.5:1 contrast on the tinted banner.
- Soften or remove the sideways nudge by editing the pixel values in `m3wrn-nudge`.
- Swap the regular expression in the submit handler for your own validation, and call `show(false)` from it to replay the error.
Form Sent Envelope That Seals With a Check
The thank-you state of a pottery studio's contact form. A letter slides down into an envelope, the flap folds shut over it, the envelope gives a small lift and a terracotta badge arrives at its corner while its check draws. Below it the card repeats the subject and reply address so the sender knows what went out.
<section class="m3env" aria-labelledby="m3env-h">
<div class="m3env-card">
<svg class="m3env-svg" viewBox="0 0 64 64" aria-hidden="true">
<rect class="m3env-paper" x="15" y="8" width="34" height="26" rx="2.5"/>
<path class="m3env-lines" d="M21 15h22M21 20.5h16"/>
<rect class="m3env-body" x="8" y="22" width="48" height="32" rx="4.5"/>
<path class="m3env-fold" d="M8.8 52.5l17.5-13M55.2 52.5l-17.5-13"/>
<path class="m3env-flap" d="M9.5 23.5L32 40l22.5-16.5"/>
<g class="m3env-badge"><circle cx="53" cy="50" r="9.5"/><path class="m3env-tick" pathLength="1" d="M48.8 50.2l2.9 2.9 5.4-5.6"/></g>
</svg>
<h2 class="m3env-title" id="m3env-h" role="status">Message sent</h2>
<p class="m3env-sub">Thanks, Leo. Your note is with Saltmarsh Ceramics, and Mara replies from the studio inbox.</p>
<dl class="m3env-sum">
<div><dt>Subject</dt><dd>A set of six bowls in sea glaze</dd></div>
<div><dt>Reply to</dt><dd>[email protected]</dd></div>
</dl>
<div class="m3env-actions">
<a class="m3env-btn" href="#">Write another message</a>
<button class="m3env-replay" type="button">Replay</button>
</div>
</div>
</section>
<style>
/* Change these: page colour, card, ink, accent (badge and envelope edge), speed of the whole sequence. */
.m3env { --m3env-bg: #f1e7da; --m3env-card: #fffaf3; --m3env-ink: #2a1f19; --m3env-accent: #a8482a; --m3env-time: 1; }
.m3env { background: var(--m3env-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3env-ink); }
.m3env-card { max-width: 480px; margin: 0 auto; background: var(--m3env-card); border: 1px solid #eadccb; border-radius: 22px; padding: 36px 30px 28px; text-align: center; box-shadow: 0 1px 2px rgba(42,31,25,.05), 0 26px 50px -30px rgba(42,31,25,.42); }
.m3env-svg { display: block; width: 112px; height: 112px; margin: 0 auto; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m3env-svg * { transform-box: fill-box; transform-origin: 50% 50%; }
.m3env-paper { fill: #fff; stroke: #c9b7a3; stroke-width: 1.5; transform: translateY(15px); }
.m3env-lines { stroke: #d8c8b6; stroke-width: 1.5; transform: translateY(15px); }
.m3env-body { fill: #f7ecdf; stroke: var(--m3env-ink); stroke-width: 2; }
.m3env-fold { stroke: #c9b7a3; stroke-width: 1.5; }
.m3env-flap { stroke: var(--m3env-ink); stroke-width: 2; transform-origin: 50% 0; }
.m3env-badge circle { fill: var(--m3env-accent); stroke: var(--m3env-card); stroke-width: 2.5; }
.m3env-tick { stroke: #fff; stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m3env-title { margin: 16px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.015em; }
.m3env-sub { margin: 8px auto 0; max-width: 36ch; font-size: 15px; line-height: 1.55; color: #5e5047; }
.m3env-sum { margin: 22px 0 0; padding: 14px 16px; border-radius: 14px; background: #f6eee4; text-align: left; }
.m3env-sum div { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 5px 0; font-size: 14px; }
.m3env-sum dt { color: #6a5b50; }
.m3env-sum dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.m3env-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px; margin-top: 22px; }
.m3env-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 999px; background: var(--m3env-ink); color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; }
.m3env-replay { min-height: 44px; padding: 0 12px; border: 0; background: none; color: #6a5b50; font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.m3env-btn:focus-visible, .m3env-replay:focus-visible { outline: 2px solid var(--m3env-accent); outline-offset: 3px; }
/* The sequence: letter slides in, flap folds shut, envelope settles, badge and check arrive. Done by about 1.5 s. */
.m3env[data-play] .m3env-paper, .m3env[data-play] .m3env-lines { animation: m3env-in calc(.5s * var(--m3env-time)) cubic-bezier(.55,0,.3,1) both; }
.m3env[data-play] .m3env-flap { animation: m3env-shut calc(.45s * var(--m3env-time)) calc(.45s * var(--m3env-time)) cubic-bezier(.55,0,.3,1) both; }
.m3env[data-play] .m3env-svg { animation: m3env-settle calc(.5s * var(--m3env-time)) calc(.8s * var(--m3env-time)) ease-out both; }
.m3env[data-play] .m3env-badge { animation: m3env-pop calc(.35s * var(--m3env-time)) calc(.95s * var(--m3env-time)) cubic-bezier(.2,.8,.3,1) both; }
.m3env[data-play] .m3env-tick { animation: m3env-draw calc(.3s * var(--m3env-time)) calc(1.15s * var(--m3env-time)) ease-out both; }
.m3env[data-play] .m3env-card > :not(svg) { animation: m3env-rise calc(.45s * var(--m3env-time)) calc(1s * var(--m3env-time)) ease-out both; }
@keyframes m3env-in { from { transform: translateY(-4px); } to { transform: translateY(15px); } }
@keyframes m3env-shut { from { transform: scaleY(-1); } to { transform: scaleY(1); } }
@keyframes m3env-settle { 0% { transform: none; } 45% { transform: translateY(-3px); } 100% { transform: none; } }
@keyframes m3env-pop { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes m3env-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m3env-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .m3env-card { padding: 30px 18px 22px; } }
@media (prefers-reduced-motion: reduce) { .m3env * { animation: none !important; } }
</style>
<script>
(function () {
/* Plays once when the card first comes into view of its nearest scroller; Replay plays it again. */
var root = document.querySelector(".m3env");
if (!root) return;
function play() { root.removeAttribute("data-play"); void root.offsetWidth; root.setAttribute("data-play", ""); }
var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { play(); io.disconnect(); } });
io.observe(root);
root.querySelector(".m3env-replay").addEventListener("click", play);
})();
</script>
With reduced motion: The sealed envelope with its check badge and the full confirmation text appear at once with no movement.
Running cost: A handful of SVG shapes animate transform, opacity and one dash offset for about a second and a half, then stop for good.
- Change `--m3env-accent` for the badge and `--m3env-ink` for the envelope outline.
- Scale the whole sequence with `--m3env-time`; values under 1 make it snappier.
- Replace the two rows of the summary list with the fields your own form collects.
Opening Checklist That Ticks Off in Turn
A cafe's morning checklist that completes itself when it scrolls into view: each box fills forest green, its tick draws, and a thin line strikes through the task, one row after the next, before a summary line confirms the list is done. The boxes are real checkboxes, so staff can untick and retick a task and the summary keeps count.
<section class="m3tsk" aria-labelledby="m3tsk-h">
<div class="m3tsk-card">
<div class="m3tsk-head">
<div>
<p class="m3tsk-kicker">Hollis Street Cafe</p>
<h2 class="m3tsk-title" id="m3tsk-h">Opening checklist</h2>
</div>
<button class="m3tsk-replay" type="button">Replay</button>
</div>
<ul class="m3tsk-list">
<li style="--i:0"><label class="m3tsk-row" for="m3tsk-c1"><input id="m3tsk-c1" type="checkbox" checked><span class="m3tsk-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path class="m3tsk-tick" pathLength="1" d="M6.5 12.5l3.6 3.6 7.4-7.6"/></svg></span><span class="m3tsk-label">Grinder calibrated</span><span class="m3tsk-time">6:42</span></label></li>
<li style="--i:1"><label class="m3tsk-row" for="m3tsk-c2"><input id="m3tsk-c2" type="checkbox" checked><span class="m3tsk-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path class="m3tsk-tick" pathLength="1" d="M6.5 12.5l3.6 3.6 7.4-7.6"/></svg></span><span class="m3tsk-label">Pastry case filled</span><span class="m3tsk-time">6:50</span></label></li>
<li style="--i:2"><label class="m3tsk-row" for="m3tsk-c3"><input id="m3tsk-c3" type="checkbox" checked><span class="m3tsk-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path class="m3tsk-tick" pathLength="1" d="M6.5 12.5l3.6 3.6 7.4-7.6"/></svg></span><span class="m3tsk-label">Milk delivery checked</span><span class="m3tsk-time">6:55</span></label></li>
<li style="--i:3"><label class="m3tsk-row" for="m3tsk-c4"><input id="m3tsk-c4" type="checkbox" checked><span class="m3tsk-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path class="m3tsk-tick" pathLength="1" d="M6.5 12.5l3.6 3.6 7.4-7.6"/></svg></span><span class="m3tsk-label">Front door unlocked</span><span class="m3tsk-time">7:00</span></label></li>
</ul>
<p class="m3tsk-done" role="status">All 4 tasks done</p>
</div>
</section>
<style>
/* Change these: page, card, ink, accent (ticked boxes), gap between ticks during the entrance. */
.m3tsk { --m3tsk-bg: #e7ece6; --m3tsk-card: #fcfdfb; --m3tsk-ink: #1d2a22; --m3tsk-accent: #2c5e45; --m3tsk-gap: .22s; }
.m3tsk { background: var(--m3tsk-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3tsk-ink); }
.m3tsk-card { max-width: 480px; margin: 0 auto; background: var(--m3tsk-card); border: 1px solid #dbe3db; border-radius: 20px; padding: 26px 24px 22px; box-shadow: 0 1px 2px rgba(29,42,34,.05), 0 22px 44px -28px rgba(29,42,34,.38); }
.m3tsk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.m3tsk-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--m3tsk-accent); }
.m3tsk-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.m3tsk-replay { min-height: 40px; padding: 0 14px; border: 1px solid #d3ddd4; border-radius: 999px; background: #fff; color: #3b4a40; font: inherit; font-size: 13px; cursor: pointer; }
.m3tsk-list { list-style: none; margin: 18px 0 0; padding: 0; }
.m3tsk-list li + li { border-top: 1px solid #edf1ec; }
.m3tsk-row { position: relative; display: flex; align-items: center; gap: 14px; min-height: 56px; cursor: pointer; }
.m3tsk-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m3tsk-box { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; border: 1.75px solid #9aa89e; background: #fff; position: relative; overflow: hidden; }
.m3tsk-box::before { content: ""; position: absolute; inset: 0; background: var(--m3tsk-accent); opacity: 0; transform: scale(.4); border-radius: 6px; transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.3,1); }
.m3tsk-box svg { position: relative; width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m3tsk-tick { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .3s ease-out .08s; }
.m3tsk-row input:checked + .m3tsk-box { border-color: var(--m3tsk-accent); }
.m3tsk-row input:checked + .m3tsk-box::before { opacity: 1; transform: none; }
.m3tsk-row input:checked + .m3tsk-box .m3tsk-tick { stroke-dashoffset: 0; }
.m3tsk-row input:focus-visible + .m3tsk-box { outline: 2px solid var(--m3tsk-accent); outline-offset: 3px; }
.m3tsk-replay:focus-visible { outline: 2px solid var(--m3tsk-accent); outline-offset: 3px; }
.m3tsk-label { position: relative; flex: 0 1 auto; font-size: 15.5px; transition: color .3s ease; }
.m3tsk-label::after { content: ""; position: absolute; left: 0; top: 52%; width: 100%; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s ease .1s; }
.m3tsk-row input:checked ~ .m3tsk-label { color: #56645a; }
.m3tsk-row input:checked ~ .m3tsk-label::after { transform: scaleX(1); }
.m3tsk-time { margin-left: auto; font-size: 13px; color: #56645a; font-variant-numeric: tabular-nums; }
.m3tsk-done { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #e9f1eb; color: var(--m3tsk-accent); font-size: 14.5px; font-weight: 600; transition: opacity .3s ease; }
/* Entrance: the boxes fill and tick one after another, then the summary appears. */
.m3tsk[data-play] .m3tsk-box::before { animation: m3tsk-fill .3s calc(var(--i) * var(--m3tsk-gap) + .15s) cubic-bezier(.2,.8,.3,1) both; }
.m3tsk[data-play] .m3tsk-tick { animation: m3tsk-draw .3s calc(var(--i) * var(--m3tsk-gap) + .3s) ease-out both; }
.m3tsk[data-play] .m3tsk-label::after { animation: m3tsk-strike .35s calc(var(--i) * var(--m3tsk-gap) + .35s) ease both; }
.m3tsk[data-play] .m3tsk-done { animation: m3tsk-rise .4s 1.2s ease-out both; }
@keyframes m3tsk-fill { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes m3tsk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m3tsk-strike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes m3tsk-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .m3tsk * { animation: none !important; transition: none !important; } .m3tsk *::before, .m3tsk *::after { animation: none !important; transition: none !important; } }
</style>
<script>
(function () {
/* Plays once when the list comes into view of its nearest scroller; ticking a box by hand updates the summary. */
var root = document.querySelector(".m3tsk");
if (!root) return;
var boxes = [].slice.call(root.querySelectorAll("input")), done = root.querySelector(".m3tsk-done"), t = 0;
function play() {
boxes.forEach(function (b) { b.checked = true; }); count();
root.removeAttribute("data-play"); void root.offsetWidth; root.setAttribute("data-play", "");
clearTimeout(t); t = setTimeout(function () { root.removeAttribute("data-play"); }, 1700);
}
function count() {
var n = boxes.filter(function (b) { return b.checked; }).length;
done.textContent = n === boxes.length ? "All " + n + " tasks done" : n + " of " + boxes.length + " tasks done";
}
boxes.forEach(function (b) { b.addEventListener("change", function () { root.removeAttribute("data-play"); count(); }); });
var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { play(); io.disconnect(); } });
io.observe(root);
root.querySelector(".m3tsk-replay").addEventListener("click", play);
})();
</script>
With reduced motion: All four boxes show filled and ticked with the labels struck through, and toggling a box changes it instantly.
Running cost: Each row runs one fill, one stroke draw and one strike line once on entry; after that only the toggled row transitions.
- Set `--m3tsk-gap` to change how far apart the rows tick during the entrance.
- Recolour ticked boxes and the summary with `--m3tsk-accent`.
- Edit the four `<li>` rows; keep the `--i` index on each so the stagger follows the new order.
Order Tracking Icons: Packed, On the Way, Delivered
A delivery tracker for a tea shop order that tells its story once when it comes into view: the box lid settles shut, a green line fills toward the van, the van pulls in from the left, the next line fills, and a check draws inside the house. Each step keeps its name and time as text under the icon.
<section class="m3trk" aria-labelledby="m3trk-h">
<div class="m3trk-card">
<div class="m3trk-head">
<div>
<p class="m3trk-kicker">Fernhill Tea Co. order 4471</p>
<h2 class="m3trk-title" id="m3trk-h" role="status">Delivered today at 14:20</h2>
</div>
<button class="m3trk-replay" type="button">Replay</button>
</div>
<ol class="m3trk-steps">
<li class="m3trk-step" style="--d:0s">
<span class="m3trk-tile"><svg class="m3trk-ic" viewBox="0 0 24 24" aria-hidden="true"><path class="m3trk-box" d="M4 9.5h16v9.8a1.2 1.2 0 0 1-1.2 1.2H5.2A1.2 1.2 0 0 1 4 19.3z"/><g class="m3trk-lid"><path d="M4 9.5l2.2-5h11.6L20 9.5"/><path d="M12 4.5v5"/></g><path d="M8 16.5h3"/></svg></span>
<span class="m3trk-name">Packed</span><span class="m3trk-when">Mon 09:10</span>
</li>
<li class="m3trk-line" aria-hidden="true" style="--d:.45s"><span></span></li>
<li class="m3trk-step" style="--d:.75s">
<span class="m3trk-tile"><svg class="m3trk-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3trk-van"><path d="M3.5 6.5h10v10h-10z"/><path d="M13.5 9.5h4l3 3.4v3.6h-7"/><circle cx="7.5" cy="17.5" r="1.8"/><circle cx="17" cy="17.5" r="1.8"/></g><path class="m3trk-speed" d="M1 10h-.5M1.5 13H0"/></svg></span>
<span class="m3trk-name">On the way</span><span class="m3trk-when">Tue 07:45</span>
</li>
<li class="m3trk-line" aria-hidden="true" style="--d:1.15s"><span></span></li>
<li class="m3trk-step" style="--d:1.4s">
<span class="m3trk-tile"><svg class="m3trk-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3.5 11L12 4.5l8.5 6.5"/><path d="M6 9.5v10.5h12V9.5"/><path class="m3trk-tick" pathLength="1" d="M9.2 14.6l2 2 3.8-3.9"/></svg></span>
<span class="m3trk-name">Delivered</span><span class="m3trk-when">Tue 14:20</span>
</li>
</ol>
<p class="m3trk-foot">Left in the porch, signed for by R. Amadi.</p>
</div>
</section>
<style>
/* Change these: page, card, ink, accent (done steps and connectors). The step delays are the --d values in the markup. */
.m3trk { --m3trk-bg: #ede6dc; --m3trk-card: #fffcf7; --m3trk-ink: #26211c; --m3trk-accent: #3d6650; }
.m3trk { background: var(--m3trk-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3trk-ink); }
.m3trk-card { max-width: 640px; margin: 0 auto; background: var(--m3trk-card); border: 1px solid #e4dbcf; border-radius: 20px; padding: 28px; box-shadow: 0 1px 2px rgba(38,33,28,.05), 0 22px 44px -28px rgba(38,33,28,.4); }
.m3trk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.m3trk-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #5f564c; }
.m3trk-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.m3trk-replay { flex: none; min-height: 40px; padding: 0 14px; border: 1px solid #ddd2c4; border-radius: 999px; background: #fff; color: #4a4239; font: inherit; font-size: 13px; cursor: pointer; }
.m3trk-replay:focus-visible { outline: 2px solid var(--m3trk-accent); outline-offset: 3px; }
.m3trk-steps { list-style: none; margin: 28px 0 0; padding: 0; display: flex; align-items: flex-start; }
.m3trk-step { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.m3trk-tile { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 16px; background: #e9f0eb; color: var(--m3trk-accent); }
.m3trk-ic { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3trk-ic * { transform-box: fill-box; transform-origin: 50% 50%; }
.m3trk-tick { stroke-dasharray: 1; stroke-dashoffset: 0; }
.m3trk-speed { opacity: 0; }
.m3trk-name { font-size: 14.5px; font-weight: 600; }
.m3trk-when { font-size: 13px; color: #625a50; font-variant-numeric: tabular-nums; }
.m3trk-line { flex: 1; height: 2px; margin-top: 27px; border-radius: 2px; background: #e2d9cc; overflow: hidden; }
.m3trk-line span { display: block; height: 100%; background: var(--m3trk-accent); transform-origin: 0 50%; }
.m3trk-foot { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid #efe8de; font-size: 14px; color: #5f564c; }
/* Entrance, step by step: the lid closes, the line fills, the van pulls in, the line fills, the check draws. */
.m3trk[data-play] .m3trk-tile { animation: m3trk-tile .4s var(--d) ease-out both; }
.m3trk[data-play] .m3trk-lid { animation: m3trk-lid .45s calc(var(--d) + .1s) cubic-bezier(.3,.7,.3,1) both; }
.m3trk[data-play] .m3trk-line span { animation: m3trk-fill .35s var(--d) ease-in-out both; }
.m3trk[data-play] .m3trk-van { animation: m3trk-van .5s calc(var(--d) + .05s) cubic-bezier(.2,.8,.3,1) both; }
.m3trk[data-play] .m3trk-speed { animation: m3trk-speed .5s calc(var(--d) + .05s) ease-out both; }
.m3trk[data-play] .m3trk-tick { animation: m3trk-draw .35s calc(var(--d) + .2s) ease-out both; }
@keyframes m3trk-tile { from { opacity: .35; transform: scale(.88); } to { opacity: 1; transform: none; } }
@keyframes m3trk-lid { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes m3trk-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes m3trk-van { from { opacity: 0; transform: translateX(-7px); } to { opacity: 1; transform: none; } }
@keyframes m3trk-speed { 0% { opacity: 0; } 40% { opacity: 1; } 100% { opacity: 0; } }
@keyframes m3trk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (max-width: 520px) {
.m3trk-card { padding: 22px 16px; }
.m3trk-step { width: 84px; }
.m3trk-tile { width: 48px; height: 48px; }
.m3trk-line { margin-top: 23px; }
}
@media (prefers-reduced-motion: reduce) { .m3trk * { animation: none !important; } }
</style>
<script>
(function () {
/* Plays once when the card first comes into view of its nearest scroller; Replay plays it again. */
var root = document.querySelector(".m3trk");
if (!root) return;
function play() { root.removeAttribute("data-play"); void root.offsetWidth; root.setAttribute("data-play", ""); }
var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { play(); io.disconnect(); } });
io.observe(root);
root.querySelector(".m3trk-replay").addEventListener("click", play);
})();
</script>
With reduced motion: All three steps appear complete with full connector lines and the drawn check on the house.
Running cost: Three icons and two connector fills animate once in sequence over about two seconds, then the card is static.
- Change the `--d` delay on each step and line in the markup to retime the sequence.
- Recolour finished steps and connectors with `--m3trk-accent`.
- For an order still in transit, drop the last step's tick and set its tile background to the neutral line colour.
Payment Received Checkmark in a Circle
A payment confirmation card for a joinery workshop: a thin ring draws itself clockwise from the top, a tinted disc settles inside it, the check strokes in from its short arm, and the heading, receipt rows and button rise after it. The whole entrance is over in under a second and a half and ends on a plain, calm receipt.
<section class="m3pay" aria-labelledby="m3pay-h">
<div class="m3pay-card">
<div class="m3pay-mark">
<svg class="m3pay-svg" viewBox="0 0 96 96" aria-hidden="true">
<circle class="m3pay-halo" cx="48" cy="48" r="44"/>
<circle class="m3pay-disc" cx="48" cy="48" r="34"/>
<circle class="m3pay-ring" cx="48" cy="48" r="34" pathLength="1"/>
<path class="m3pay-check" pathLength="1" d="M34 49.5l9.5 9.5L63 38.5"/>
</svg>
</div>
<div class="m3pay-copy">
<h2 class="m3pay-title" id="m3pay-h" role="status">Payment received</h2>
<p class="m3pay-sub">Thank you. Alder & Pine Joinery has been told and a receipt is on its way to your inbox.</p>
<dl class="m3pay-rows">
<div><dt>Invoice</dt><dd>AP-2087</dd></div>
<div><dt>Paid on</dt><dd>14 October</dd></div>
<div><dt>Method</dt><dd>Card ending 4418</dd></div>
</dl>
<div class="m3pay-actions">
<a class="m3pay-btn" href="#">View receipt</a>
<button class="m3pay-replay" type="button">Replay</button>
</div>
</div>
</div>
</section>
<style>
/* Change these: page colour, card, ink, accent (circle and check), total length of the entrance. */
.m3pay { --m3pay-bg: #efe9df; --m3pay-card: #fffdf9; --m3pay-ink: #22201c; --m3pay-accent: #2d6b4f; --m3pay-time: 1; }
.m3pay { background: var(--m3pay-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3pay-ink); }
.m3pay-card { max-width: 460px; margin: 0 auto; background: var(--m3pay-card); border: 1px solid #e6dfd2; border-radius: 22px; padding: 36px 32px 30px; text-align: center; box-shadow: 0 1px 2px rgba(34,32,28,.05), 0 26px 50px -30px rgba(34,32,28,.4); }
.m3pay-svg { display: block; margin: 0 auto; width: 104px; height: 104px; overflow: visible; }
.m3pay-svg * { transform-box: fill-box; transform-origin: 50% 50%; }
.m3pay-halo { fill: var(--m3pay-accent); opacity: .08; }
.m3pay-disc { fill: var(--m3pay-accent); opacity: .12; }
.m3pay-ring { fill: none; stroke: var(--m3pay-accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; transform: rotate(-90deg); }
.m3pay-check { fill: none; stroke: var(--m3pay-accent); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m3pay-title { margin: 18px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.015em; }
.m3pay-sub { margin: 8px auto 0; max-width: 34ch; font-size: 15px; line-height: 1.55; color: #57524a; }
.m3pay-rows { margin: 24px 0 0; padding: 4px 0; border-top: 1px solid #ece6db; border-bottom: 1px solid #ece6db; text-align: left; }
.m3pay-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14.5px; }
.m3pay-rows dt { color: #5f594f; }
.m3pay-rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.m3pay-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 24px; }
.m3pay-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 999px; background: var(--m3pay-ink); color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; }
.m3pay-replay { min-height: 44px; padding: 0 14px; border: 0; background: none; color: #5f594f; font: inherit; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.m3pay-btn:focus-visible, .m3pay-replay:focus-visible { outline: 2px solid var(--m3pay-accent); outline-offset: 3px; }
/* The entrance: ring draws, disc settles, check draws, words rise. Ends by about 1.4 s. */
.m3pay[data-play] .m3pay-ring { animation: m3pay-draw calc(.6s * var(--m3pay-time)) cubic-bezier(.65,0,.35,1) both; }
.m3pay[data-play] .m3pay-disc { animation: m3pay-settle calc(.5s * var(--m3pay-time)) calc(.35s * var(--m3pay-time)) ease-out both; }
.m3pay[data-play] .m3pay-check { animation: m3pay-draw calc(.4s * var(--m3pay-time)) calc(.55s * var(--m3pay-time)) cubic-bezier(.65,0,.35,1) both; }
.m3pay[data-play] .m3pay-halo { animation: m3pay-halo calc(.9s * var(--m3pay-time)) calc(.7s * var(--m3pay-time)) ease-out both; }
.m3pay[data-play] .m3pay-copy > * { animation: m3pay-rise calc(.5s * var(--m3pay-time)) ease-out both; }
.m3pay[data-play] .m3pay-copy > :nth-child(1) { animation-delay: calc(.6s * var(--m3pay-time)); }
.m3pay[data-play] .m3pay-copy > :nth-child(2) { animation-delay: calc(.7s * var(--m3pay-time)); }
.m3pay[data-play] .m3pay-copy > :nth-child(3) { animation-delay: calc(.8s * var(--m3pay-time)); }
.m3pay[data-play] .m3pay-copy > :nth-child(4) { animation-delay: calc(.9s * var(--m3pay-time)); }
@keyframes m3pay-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m3pay-settle { from { opacity: 0; transform: scale(.7); } to { opacity: .12; transform: scale(1); } }
@keyframes m3pay-halo { 0% { opacity: 0; transform: scale(.8); } 50% { opacity: .14; } 100% { opacity: .08; transform: scale(1); } }
@keyframes m3pay-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .m3pay-card { padding: 30px 20px 24px; } }
@media (prefers-reduced-motion: reduce) { .m3pay * { animation: none !important; } }
</style>
<script>
(function () {
/* Plays once when the card first comes into view of its nearest scroller; Replay plays it again. */
var root = document.querySelector(".m3pay");
if (!root) return;
function play() { root.removeAttribute("data-play"); void root.offsetWidth; root.setAttribute("data-play", ""); }
var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { play(); io.disconnect(); } });
io.observe(root);
root.querySelector(".m3pay-replay").addEventListener("click", play);
})();
</script>
With reduced motion: The circle, the check and the receipt details are all shown complete from the first frame.
Running cost: Four SVG shapes and four lines of text animate once for about a second and a half, then nothing runs at all.
- Recolour ring, disc and check together through `--m3pay-accent`.
- Set `--m3pay-time` to 1.3 for a slower draw or 0.7 for a brisker one; every delay scales with it.
- Swap the `<dl>` rows for your own order details; the rise stagger follows the order of the blocks.
Voice Note Microphone Icon With Level Bars
The voice note control of a lettings agency's repair form. Press the dark round button and the microphone gives way to a stop square, a soft red ring breathes around it, a dot blinks beside the word Recording and eight level bars rise and fall out of step. Press again and everything settles to a still, ready note.
<section class="m3mic" aria-labelledby="m3mic-h">
<div class="m3mic-card">
<p class="m3mic-kicker">Brightwater Lettings</p>
<h2 class="m3mic-title" id="m3mic-h">Describe the repair in a voice note</h2>
<p class="m3mic-sub">Say which room, what is wrong and when someone can visit.</p>
<div class="m3mic-panel">
<button class="m3mic-btn" type="button" aria-pressed="false" aria-label="Record voice note">
<svg class="m3mic-ic" viewBox="0 0 24 24" aria-hidden="true">
<g class="m3mic-mic"><rect x="9" y="3.5" width="6" height="11" rx="3"/><path d="M6 11.5a6 6 0 0 0 12 0"/><path d="M12 17.5v3"/></g>
<rect class="m3mic-stop" x="7.5" y="7.5" width="9" height="9" rx="2"/>
</svg>
</button>
<div class="m3mic-info">
<p class="m3mic-state"><span class="m3mic-dot" aria-hidden="true"></span><span class="m3mic-word">Tap to record</span></p>
<p class="m3mic-time">0:00</p>
</div>
<svg class="m3mic-bars" viewBox="0 0 64 24" aria-hidden="true">
<rect x="1" y="7" width="3" height="10" rx="1.5"/><rect x="9" y="4" width="3" height="16" rx="1.5"/><rect x="17" y="2" width="3" height="20" rx="1.5"/><rect x="25" y="5" width="3" height="14" rx="1.5"/><rect x="33" y="3" width="3" height="18" rx="1.5"/><rect x="41" y="6" width="3" height="12" rx="1.5"/><rect x="49" y="4" width="3" height="16" rx="1.5"/><rect x="57" y="8" width="3" height="8" rx="1.5"/>
</svg>
</div>
<p class="m3mic-note">This demo shows the interface only; it does not use your microphone.</p>
<p class="m3mic-live" role="status"></p>
</div>
</section>
<style>
/* Change these: page, card, ink, record red, bar colour. */
.m3mic { --m3mic-bg: #dfe4e8; --m3mic-card: #fbfcfc; --m3mic-ink: #18222c; --m3mic-rec: #c2362b; --m3mic-bar: #3b5a78; }
.m3mic { background: var(--m3mic-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; color: var(--m3mic-ink); }
.m3mic-card { max-width: 520px; margin: 0 auto; background: var(--m3mic-card); border: 1px solid #d5dce2; border-radius: 22px; padding: 28px; box-shadow: 0 1px 2px rgba(24,34,44,.05), 0 22px 44px -28px rgba(24,34,44,.42); }
.m3mic-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #4a5866; }
.m3mic-title { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.m3mic-sub { margin: 6px 0 0; font-size: 15px; color: #4f5d6a; }
.m3mic-panel { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding: 14px 18px 14px 14px; border-radius: 18px; background: #eef2f5; }
.m3mic-btn { position: relative; flex: none; display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 999px; background: var(--m3mic-ink); color: #fff; cursor: pointer; transition: background-color .25s ease; }
.m3mic-btn::before { content: ""; position: absolute; inset: -6px; border-radius: 999px; border: 2px solid var(--m3mic-rec); opacity: 0; transform: scale(.9); transition: opacity .3s ease, transform .3s ease; }
.m3mic-btn:focus-visible { outline: 2px solid var(--m3mic-ink); outline-offset: 10px; }
.m3mic-ic { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m3mic-ic * { transform-box: fill-box; transform-origin: 50% 50%; transition: opacity .25s ease, transform .3s ease; }
.m3mic-stop { fill: currentColor; stroke: none; opacity: 0; transform: scale(.5); }
.m3mic-info { flex: none; min-width: 108px; }
.m3mic-state { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 600; }
.m3mic-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--m3mic-rec); opacity: 0; }
.m3mic-time { margin: 3px 0 0; font-size: 13.5px; color: #4f5d6a; font-variant-numeric: tabular-nums; }
.m3mic-bars { flex: 0 1 150px; min-width: 0; height: 44px; margin-left: auto; fill: var(--m3mic-bar); }
.m3mic-bars rect { transform-box: fill-box; transform-origin: 50% 50%; transform: scaleY(.2); opacity: .4; transition: transform .35s ease, opacity .35s ease; }
.m3mic-note { margin: 14px 0 0; font-size: 12.5px; color: #56636f; }
.m3mic-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Recording: mic gives way to a stop square, the ring and dot appear, the bars move out of phase. */
.m3mic[data-rec] .m3mic-btn { background: var(--m3mic-rec); }
.m3mic[data-rec] .m3mic-btn::before { opacity: .35; transform: none; animation: m3mic-ring 1.6s ease-in-out infinite; }
.m3mic[data-rec] .m3mic-mic { opacity: 0; transform: scale(.6); }
.m3mic[data-rec] .m3mic-stop { opacity: 1; transform: none; }
.m3mic[data-rec] .m3mic-dot { animation: m3mic-blink 1.2s ease-in-out infinite; }
.m3mic[data-rec] .m3mic-bars rect { opacity: 1; animation: m3mic-level .9s ease-in-out infinite alternate; }
.m3mic[data-rec] .m3mic-bars rect:nth-child(2n) { animation-duration: .7s; animation-delay: -.3s; }
.m3mic[data-rec] .m3mic-bars rect:nth-child(3n) { animation-duration: 1.1s; animation-delay: -.6s; }
.m3mic[data-rec] .m3mic-bars rect:nth-child(5n) { animation-duration: .8s; animation-delay: -.15s; }
@keyframes m3mic-level { 0% { transform: scaleY(.4); } 60% { transform: scaleY(1); } 100% { transform: scaleY(.6); } }
@keyframes m3mic-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes m3mic-ring { 0%,100% { opacity: .35; transform: none; } 50% { opacity: .15; transform: scale(1.06); } }
.m3mic[data-off] * { animation-play-state: paused !important; }
.m3mic[data-off] *::before { animation-play-state: paused !important; }
@media (max-width: 480px) { .m3mic-card { padding: 22px 16px; } .m3mic-panel { gap: 12px; } .m3mic-info { min-width: 96px; } }
@media (prefers-reduced-motion: reduce) {
.m3mic *, .m3mic *::before { animation: none !important; transition: none !important; }
.m3mic[data-rec] .m3mic-bars rect { transform: scaleY(.7); }
.m3mic[data-rec] .m3mic-dot { opacity: 1; }
}
</style>
<script>
(function () {
/* The interface only: connect your own recorder (getUserMedia + MediaRecorder) inside start() and stop(). */
var root = document.querySelector(".m3mic");
if (!root) return;
var btn = root.querySelector(".m3mic-btn"), word = root.querySelector(".m3mic-word"), time = root.querySelector(".m3mic-time"), live = root.querySelector(".m3mic-live");
var secs = 0, tick = 0, seen = true;
function fmt(s) { return Math.floor(s / 60) + ":" + String(s % 60).padStart(2, "0"); }
function start(say) {
root.setAttribute("data-rec", ""); btn.setAttribute("aria-pressed", "true"); btn.setAttribute("aria-label", "Stop recording");
word.textContent = "Recording"; secs = 0; time.textContent = fmt(0); if (say) live.textContent = "Recording started";
clearInterval(tick); tick = setInterval(function () { if (seen) time.textContent = fmt(++secs); }, 1000);
}
function stop() {
root.removeAttribute("data-rec"); btn.setAttribute("aria-pressed", "false"); btn.setAttribute("aria-label", "Record voice note");
clearInterval(tick); word.textContent = "Note ready"; live.textContent = "Recording stopped at " + fmt(secs);
}
btn.addEventListener("click", function () { clearTimeout(demo); if (root.hasAttribute("data-rec")) stop(); else start(true); });
/* Preview only: starts a silent recording state shortly after load. Delete for real use. */
var demo = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : setTimeout(function () { start(false); }, 500);
new IntersectionObserver(function (en) {
seen = en[0].isIntersecting;
if (seen) root.removeAttribute("data-off"); else root.setAttribute("data-off", "");
}).observe(root);
})();
</script>
With reduced motion: Recording is shown by the red button, a solid dot, the stop square and still bars at a fixed height, with the timer still counting.
Running cost: Eight bars scale on the compositor only while the recording state is on; a one second timer runs alongside and both pause off screen.
- Recolour the recording state with `--m3mic-rec` and the bars with `--m3mic-bar`.
- Drive the bars from real input by setting each rect's scaleY from an AnalyserNode instead of the `m3mic-level` keyframes.
- Delete the `demo` line so the preview no longer starts in the recording state.
Weather Forecast Card With Animated Icons
A deep navy forecast card for a harbour town with six condition icons that idle quietly: sun rays turn very slowly, a cloud drifts a pixel either way, rain lines and snow dots fall and fade, wind gusts travel along their curls and the storm bolt flickers by opacity. Each day names its condition in text beside the icon.
<section class="m3wth" aria-labelledby="m3wth-h">
<article class="m3wth-card">
<header class="m3wth-now">
<div>
<p class="m3wth-kicker">Kestrel Bay Harbour</p>
<h2 class="m3wth-title" id="m3wth-h">Showers until mid afternoon</h2>
<p class="m3wth-temp">14° <span>feels like 11°</span></p>
</div>
<svg class="m3wth-ic m3wth-big" viewBox="0 0 24 24" aria-hidden="true">
<g transform="translate(0 -3)"><path class="m3wth-cloud" d="M7.5 18h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 11.1 3.5 3.5 0 0 0 7.5 18z"/></g>
<g class="m3wth-rain"><path d="M9 17.5l-.6 2.5"/><path d="M12.4 17.5l-.6 2.5"/><path d="M15.8 17.5l-.6 2.5"/></g>
</svg>
</header>
<ul class="m3wth-days" aria-label="Next five days">
<li>
<span class="m3wth-day">Thu</span>
<svg class="m3wth-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3wth-rays"><path d="M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4"/></g><circle class="m3wth-sun" cx="12" cy="12" r="4"/></svg>
<span class="m3wth-cond">Sunny</span><span class="m3wth-hl">18° / 9°</span>
</li>
<li>
<span class="m3wth-day">Fri</span>
<svg class="m3wth-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3wth-rays m3wth-slow"><path d="M8.5 2.5v1.5M2.5 8.5H4M4.3 4.3l1 1M12.7 4.3l-1 1"/></g><circle class="m3wth-sun" cx="8.5" cy="8.5" r="3"/><g transform="translate(1.5 2.5)"><path class="m3wth-cloud m3wth-drift" d="M7.5 18h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 11.1 3.5 3.5 0 0 0 7.5 18z"/></g></svg>
<span class="m3wth-cond">Partly cloudy</span><span class="m3wth-hl">16° / 8°</span>
</li>
<li>
<span class="m3wth-day">Sat</span>
<svg class="m3wth-ic" viewBox="0 0 24 24" aria-hidden="true"><g class="m3wth-wind"><path pathLength="1" d="M3 9h10.5a2.8 2.8 0 1 0-2.8-2.8"/><path pathLength="1" d="M3 13.5h15a2.8 2.8 0 1 1-2.8 2.8"/><path pathLength="1" d="M3 18h7"/></g></svg>
<span class="m3wth-cond">Windy</span><span class="m3wth-hl">13° / 7°</span>
</li>
<li>
<span class="m3wth-day">Sun</span>
<svg class="m3wth-ic" viewBox="0 0 24 24" aria-hidden="true"><g transform="translate(0 -3)"><path class="m3wth-cloud" d="M7.5 18h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 11.1 3.5 3.5 0 0 0 7.5 18z"/></g><g class="m3wth-snow"><circle cx="9" cy="18" r="1"/><circle cx="12.4" cy="19.5" r="1"/><circle cx="15.8" cy="18" r="1"/></g></svg>
<span class="m3wth-cond">Light snow</span><span class="m3wth-hl">3° / -2°</span>
</li>
<li>
<span class="m3wth-day">Mon</span>
<svg class="m3wth-ic" viewBox="0 0 24 24" aria-hidden="true"><g transform="translate(0 -3)"><path class="m3wth-cloud" d="M7.5 18h9a4 4 0 0 0 .6-7.95A5.5 5.5 0 0 0 6.6 11.1 3.5 3.5 0 0 0 7.5 18z"/></g><path class="m3wth-bolt" d="M12.8 15.5l-2.3 3.4h3l-2 3.6"/></svg>
<span class="m3wth-cond">Thunderstorms</span><span class="m3wth-hl">12° / 8°</span>
</li>
</ul>
<p class="m3wth-note">Sample forecast for an invented harbour town.</p>
</article>
</section>
<style>
/* Change these: page colour, card colour, text, sun and rain colours, and loop speed. */
.m3wth { --m3wth-bg: #ece4d6; --m3wth-card: #13233a; --m3wth-text: #f3ede2; --m3wth-sunc: #f2b65e; --m3wth-rainc: #9cc6ea; --m3wth-speed: 1; }
.m3wth { background: var(--m3wth-bg); padding: 64px 16px; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; }
.m3wth-card { max-width: 720px; margin: 0 auto; background: var(--m3wth-card); color: var(--m3wth-text); border-radius: 24px; padding: 32px; box-shadow: 0 2px 4px rgba(19,35,58,.12), 0 30px 60px -30px rgba(19,35,58,.55); }
.m3wth-now { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 26px; border-bottom: 1px solid rgba(243,237,226,.14); }
.m3wth-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #c5cfdc; }
.m3wth-title { margin: 8px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.m3wth-temp { margin: 12px 0 0; font-size: 44px; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.m3wth-temp span { font-size: 15px; letter-spacing: 0; color: #c5cfdc; margin-left: 6px; }
.m3wth-ic { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.m3wth-big { width: 112px; height: 112px; flex: none; stroke-width: 1.05; }
.m3wth-ic g, .m3wth-ic path, .m3wth-ic circle { transform-box: fill-box; transform-origin: 50% 50%; }
.m3wth-sun, .m3wth-rays { stroke: var(--m3wth-sunc); }
.m3wth-rain, .m3wth-snow { stroke: var(--m3wth-rainc); }
.m3wth-snow { fill: var(--m3wth-rainc); }
.m3wth-bolt { stroke: var(--m3wth-sunc); }
.m3wth-cloud { fill: var(--m3wth-card); }
.m3wth-days { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.m3wth-days li { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: 16px; background: rgba(243,237,226,.05); text-align: center; }
.m3wth-day { font-size: 13px; font-weight: 600; color: #c5cfdc; }
.m3wth-cond { font-size: 13px; line-height: 1.3; }
.m3wth-hl { font-size: 13px; color: #c5cfdc; font-variant-numeric: tabular-nums; }
.m3wth-note { margin: 18px 0 0; font-size: 12.5px; color: #aab6c6; }
/* The loops: slow, so every frame reads as a finished icon. */
.m3wth-rays { animation: m3wth-spin calc(24s * var(--m3wth-speed)) linear infinite; }
.m3wth-slow { transform-box: view-box; transform-origin: 8.5px 8.5px; animation-duration: calc(36s * var(--m3wth-speed)); }
.m3wth-drift { animation: m3wth-drift calc(7s * var(--m3wth-speed)) ease-in-out infinite; }
.m3wth-rain path { animation: m3wth-fall calc(1.4s * var(--m3wth-speed)) linear infinite; }
.m3wth-rain path:nth-child(2) { animation-delay: -.5s; }
.m3wth-rain path:nth-child(3) { animation-delay: -.95s; }
.m3wth-snow circle { animation: m3wth-flake calc(3s * var(--m3wth-speed)) linear infinite; }
.m3wth-snow circle:nth-child(2) { animation-delay: -1s; }
.m3wth-snow circle:nth-child(3) { animation-delay: -2s; }
.m3wth-wind path { stroke-dasharray: .72 .28; animation: m3wth-gust calc(3.2s * var(--m3wth-speed)) linear infinite; }
.m3wth-wind path:nth-child(2) { animation-delay: -1.2s; }
.m3wth-wind path:nth-child(3) { animation-delay: -2.1s; }
.m3wth-bolt { animation: m3wth-flash calc(4s * var(--m3wth-speed)) linear infinite; }
@keyframes m3wth-spin { to { transform: rotate(360deg); } }
@keyframes m3wth-drift { 0%,100% { transform: translateX(-.8px); } 50% { transform: translateX(1px); } }
@keyframes m3wth-fall { 0% { transform: translateY(-1.5px); opacity: 0; } 25% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(2.5px); opacity: 0; } }
@keyframes m3wth-flake { 0% { transform: translateY(-2px); opacity: 0; } 20%,75% { opacity: 1; } 100% { transform: translateY(2.5px); opacity: 0; } }
@keyframes m3wth-gust { to { stroke-dashoffset: -1; } }
@keyframes m3wth-flash { 0%,62%,100% { opacity: 1; } 64% { opacity: .15; } 67% { opacity: 1; } 70% { opacity: .3; } 73% { opacity: 1; } }
.m3wth[data-off] * { animation-play-state: paused !important; }
@media (max-width: 640px) {
.m3wth-card { padding: 24px 16px; }
.m3wth-big { width: 84px; height: 84px; }
.m3wth-days { grid-template-columns: 1fr; gap: 6px; }
.m3wth-days li { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 8px 14px; text-align: left; }
.m3wth-day { width: 34px; }
.m3wth-cond { flex: 1; }
.m3wth-days .m3wth-ic { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) { .m3wth * { animation: none !important; } }
</style>
<script>
(function () {
/* Pauses the loops while the card is off screen or the tab is hidden. */
var root = document.querySelector(".m3wth");
if (!root) return;
var seen = true;
function apply() { if (seen && !document.hidden) root.removeAttribute("data-off"); else root.setAttribute("data-off", ""); }
new IntersectionObserver(function (en) { seen = en[0].isIntersecting; apply(); }).observe(root);
document.addEventListener("visibilitychange", apply);
})();
</script>
With reduced motion: Each condition icon is drawn complete and stays still: sun, cloud, rain lines, snow, wind and bolt all in place.
Running cost: Six small SVG loops on transform, opacity and dash offset, paused by a tiny observer whenever the card leaves the screen or the tab hides.
- Recolour the sun and the rain through `--m3wth-sunc` and `--m3wth-rainc`; the cloud fill follows `--m3wth-card` so it hides whatever sits behind it.
- Raise `--m3wth-speed` to 1.5 or 2 for calmer loops across the whole card.
- Copy any single `<svg>` with its classes to use one icon on its own, such as the rain icon in a site header.
Performance notes
An icon is a few paths, so even stroke drawing costs very little. The rule that matters is to stop when nothing is happening: success states play once and end, and looping icons pause with animation-play-state when they leave the screen or when the tab is hidden.
Inline SVG avoids an extra request and lets CSS reach every path. If you use the same icon many times on a page, define it once in a symbol element and reference it with use, and keep the animation on the wrapper.
Questions
How do I animate an SVG icon with CSS?
Paste the SVG inline, give the part you want to move a class, and set transform-box: fill-box with a transform-origin so it turns or scales around its own centre. Then add a @keyframes rule that changes transform or opacity. Drawing a stroke uses stroke-dasharray and stroke-dashoffset instead.
How does the drawing checkmark work?
The check is one path with pathLength set to 1, which makes its length a round number. Stroke-dasharray of 1 and stroke-dashoffset of 1 hide it; animating the offset to 0 draws it from start to end. It works in every current browser.
Should animated icons be announced to screen readers?
Only when they tell people something new. Hide decorative motion with aria-hidden. For a success or error state, put the message in text inside an element with role status or aria-live polite so it is read once, whatever the icon is doing.
Are these a replacement for an icon font or an animation player?
For small state changes, yes: they are plain SVG and CSS with no font file, no JSON and no script to load. A full icon library is still the faster route for hundreds of static glyphs.
Also in the gallery: CSS Hamburger Menu Collection with 12 Animated Icons and an Accessible Mobile Nav.
More collections: SVG Line Drawing Animations: Paths That Draw Themselves, Blob Animations and Morphing Shapes in CSS and SVG, Animated Charts, Infographics and Flow Diagrams in SVG. All motion graphics. Build your site free to have a full site built around them.
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App