SVG Line Drawing Animations: Paths That Draw Themselves
Updated 2026-10-16. 7 effects.
A line drawing animation makes an SVG look as if it is being drawn by hand. Each path gets pathLength="1", stroke-dasharray: 1 and stroke-dashoffset: 1, and a transition or keyframe moves the offset to 0. Stagger the paths with delays and the picture builds stroke by stroke. Every drawing below starts when it scrolls into view.
The technique only works on strokes, so the artwork has to be drawn as lines rather than filled outlines. Most illustrations exported from a design tool are fills; for drawing you want open paths with a stroke colour, round caps and no fill, which is how every piece here is made.
Line drawings are the lightest way to add a spot illustration: an empty inbox, a finished task, a route on a map, a building sketch at the top of a page. They are a good substitute for an animation file and player when the motion is drawing, fading and moving parts, because the result is plain markup you can recolour with one CSS variable.
Short text drawn as a pen stroke and a hand-drawn underline already have their own pieces in the text effects; this collection is for pictures.
Compare them
| Effect | Built with | Size (gzipped) | Running cost | Browser support |
|---|---|---|---|---|
| Architect House Elevation Sketch That Draws Itself | CSS only | 3.7 KB | About thirty thin strokes repaint while they draw over roughly 1.6 seconds, a few at a time, then nothing changes. | All current browsers |
| Blueprint of a Wooden Side Chair with Dimensions | CSS only | 3.3 KB | Around twenty strokes repaint in a 1.5 second stagger, then the sheet never changes. | All current browsers |
| Botanical Olive Sprig Line Illustration | CSS only | 3.7 KB | Twenty-odd short leaf strokes repaint while drawing for about 1.5 seconds, then the card is static. | All current browsers |
| Coffee Cup Spot Illustration with Rising Steam | CSS only | 3.3 KB | After the one-time drawing, three short steam strokes repaint in a slow loop that pauses off screen. | All current browsers |
| Empty Inbox State with Tray and Paper Plane | CSS only | 3.1 KB | Eight small strokes repaint for about 1.4 seconds when the pane first shows, then nothing runs. | All current browsers |
| Mountain Range and Hut Trail on a Navy Hero | CSS only | 3.5 KB | Long ridge strokes repaint while they draw for under 1.6 seconds, then the hero is static. | All current browsers |
| No Search Results State with Empty Clothes Rail | CSS only | 3.3 KB | Twelve short strokes repaint for about 1.5 seconds, then the page is static. | All current browsers |
Architect House Elevation Sketch That Draws Itself
An elevation sketch for an architecture studio's project page. Faint construction lines go down first, then the ground line, walls, gable roof, chimney, windows, door and the lean-to kitchen, with a loose tree and a dimension line last, about a second and a half in total. On phones the sheet moves under the project notes.
<section class="m4hse">
<div class="m4hse-wrap">
<div class="m4hse-text">
<p class="m4hse-eyebrow">Project 07 · Planning stage</p>
<h2 class="m4hse-h">Ferry Road House</h2>
<p class="m4hse-p">A two-storey family house on a narrow riverside plot, with a timber lean-to kitchen facing the garden and a brick stack kept from the old cottage.</p>
<dl class="m4hse-dl">
<div><dt>Studio</dt><dd>Oakes & Lund Architects</dd></div>
<div><dt>Drawing</dt><dd>South elevation, first sketch</dd></div>
</dl>
<a class="m4hse-link" href="#">See the plans</a>
</div>
<figure class="m4hse-sheet">
<svg class="m4hse-art" viewBox="0 0 480 304" aria-hidden="true" focusable="false">
<g class="m4hse-guide">
<path class="m4hse-s m4hse-t0 m4hse-slow" d="M34 131.5H440" pathLength="1"/>
<path class="m4hse-s m4hse-t1 m4hse-slow" d="M120 34V286" pathLength="1"/>
<path class="m4hse-s m4hse-t2 m4hse-slow" d="M300 34V286" pathLength="1"/>
<path class="m4hse-s m4hse-t3 m4hse-slow" d="M210 26V284" pathLength="1"/>
</g>
<g class="m4hse-pen">
<path class="m4hse-s m4hse-t3 m4hse-slow" d="M12 262.5C120 261.8 300 262.6 468 262" pathLength="1"/>
<path class="m4hse-s m4hse-t5" d="M120.5 262V131" pathLength="1"/>
<path class="m4hse-s m4hse-t6" d="M299.5 131V262" pathLength="1"/>
<path class="m4hse-s m4hse-t7 m4hse-slow" d="M102 145.5L210 57.5L318 145.5" pathLength="1"/>
<path class="m4hse-s m4hse-t8 m4hse-thin" d="M111 145.2L210 64.5L309 145.2" pathLength="1"/>
<path class="m4hse-s m4hse-t9" d="M250 90.5V50H266V103.5" pathLength="1"/>
<path class="m4hse-s m4hse-t10 m4hse-quick" d="M245.5 50H270.5M245.5 45.5H270.5" pathLength="1"/>
<path class="m4hse-s m4hse-t11 m4hse-thin m4hse-quick" d="M250 60H266M250 70H266M250 80H266M258 50V60M254 60V70M262 70V80" pathLength="1"/>
<circle class="m4hse-s m4hse-t10" cx="210" cy="104" r="12" pathLength="1" transform="rotate(-90 210 104)"/>
<path class="m4hse-s m4hse-t11 m4hse-thin m4hse-quick" d="M198 104H222M210 92V116" pathLength="1"/>
<path class="m4hse-s m4hse-t11" d="M142 149H178V185H142Z" pathLength="1"/>
<path class="m4hse-s m4hse-t12 m4hse-thin m4hse-quick" d="M160 149V185M142 167H178" pathLength="1"/>
<path class="m4hse-s m4hse-t12" d="M242 149H278V185H242Z" pathLength="1"/>
<path class="m4hse-s m4hse-t13 m4hse-thin m4hse-quick" d="M260 149V185M242 167H278" pathLength="1"/>
<path class="m4hse-s m4hse-t13 m4hse-thin" d="M139 188.5H181M239 188.5H281" pathLength="1"/>
<path class="m4hse-s m4hse-t14" d="M140 204H192V242H140Z" pathLength="1"/>
<path class="m4hse-s m4hse-t15 m4hse-thin m4hse-quick" d="M157.3 204V242M174.7 204V242" pathLength="1"/>
<path class="m4hse-s m4hse-t15" d="M236 262V215A17 17 0 0 1 270 215V262" pathLength="1"/>
<path class="m4hse-s m4hse-t16 m4hse-thin" d="M241 262V216A12 12 0 0 1 265 216V262" pathLength="1"/>
<path class="m4hse-s m4hse-t17 m4hse-quick" d="M228 262V257H278V262" pathLength="1"/>
<path class="m4hse-s m4hse-t16" d="M300 168.5L400 192" pathLength="1"/>
<path class="m4hse-s m4hse-t17" d="M386 189V262" pathLength="1"/>
<path class="m4hse-s m4hse-t18" d="M322 210H364V242H322Z" pathLength="1"/>
<path class="m4hse-s m4hse-t19 m4hse-thin m4hse-quick" d="M343 210V242" pathLength="1"/>
<path class="m4hse-s m4hse-t18 m4hse-thin" d="M396 249L408 237M404 253L418 239M414 256L426 244M424 259L434 249" pathLength="1"/>
<path class="m4hse-s m4hse-t19 m4hse-thin" d="M306 176L380 193.5M306 183L370 198" pathLength="1"/>
</g>
<g class="m4hse-tree">
<path class="m4hse-s m4hse-t8 m4hse-slow" d="M66 262C66.5 240 65 220 67 192M66.3 232C60 224 55 216 50 206M66.6 214C72 208 78 203 85 198" pathLength="1"/>
<path class="m4hse-s m4hse-t10 m4hse-slow m4hse-thin" d="M62 199C40 204 24 188 31 171C20 158 32 136 50 140C52 122 76 116 86 130C102 126 112 144 104 158C116 170 106 192 88 190C82 202 70 204 62 199Z" pathLength="1"/>
<path class="m4hse-s m4hse-t13 m4hse-thin" d="M44 166C48 158 54 156 60 158M78 150C84 148 90 152 92 158M70 178C76 176 82 178 84 182" pathLength="1"/>
</g>
<g class="m4hse-dim">
<path class="m4hse-s m4hse-t20 m4hse-thin m4hse-quick" d="M120 291H300M120 285V297M300 285V297" pathLength="1"/>
<text class="m4hse-f m4hse-t22" x="210" y="286" text-anchor="middle">9.6 m</text>
<text class="m4hse-f m4hse-t23" x="440" y="124" text-anchor="end">eaves</text>
</g>
</svg>
<figcaption class="m4hse-cap"><span>Oakes & Lund</span><span>Sheet A2 · 1:100</span></figcaption>
</figure>
</div>
<button type="button" class="m4hse-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the paper and graphite colours at the top of .m4hse, and the delay step in the .t rules at the end. */
.m4hse { --m4hse-bg: #ebe5d9; --m4hse-sheet: #f8f4ec; --m4hse-ink: #2f2e2b; --m4hse-quiet: #625d55; --m4hse-line: #d3cabb; --m4hse-focus: #2f2e2b; --m4hse-pencil: #34332f; }
.m4hse { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4hse *, .m4hse *::before, .m4hse *::after { box-sizing: border-box; }
.m4hse svg { display: block; }
.m4hse .m4hse-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4hse-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4hse-line); border-radius: 999px; background: var(--m4hse-replaybg, transparent); color: var(--m4hse-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4hse-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4hse-replay:hover { color: var(--m4hse-ink); }
.m4hse-replay:focus-visible { outline: 2px solid var(--m4hse-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4hse.is-js:not([data-run]) .m4hse-s { stroke-dashoffset: 1; }
.m4hse.is-js:not([data-run]) .m4hse-f { opacity: 0; }
}
.m4hse[data-run] .m4hse-s { animation: m4hse-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4hse[data-run] .m4hse-f { animation: m4hse-fade .5s ease-out both; }
.m4hse[data-run] .m4hse-slow { animation-duration: 1s; }
.m4hse[data-run] .m4hse-quick { animation-duration: .35s; }
@keyframes m4hse-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4hse-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4hse[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4hse *, .m4hse *::before, .m4hse *::after { animation: none !important; transition: none !important; }
.m4hse-replay { display: none; }
}
.m4hse { background: var(--m4hse-bg); color: var(--m4hse-ink); padding: 56px clamp(20px, 5vw, 64px) 76px; }
.m4hse-wrap { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center; }
.m4hse-eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--m4hse-quiet); }
.m4hse-h { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(32px, 4vw, 46px); line-height: 1.05; letter-spacing: -.015em; }
.m4hse-p { margin: 16px 0 0; font-size: 16px; line-height: 1.6; color: var(--m4hse-quiet); max-width: 32em; }
.m4hse-dl { margin: 22px 0 0; display: grid; gap: 10px; }
.m4hse-dl div { display: flex; gap: 14px; font-size: 14px; border-top: 1px solid var(--m4hse-line); padding-top: 10px; }
.m4hse-dl dt { width: 72px; flex: none; color: var(--m4hse-quiet); }
.m4hse-dl dd { margin: 0; }
.m4hse-link { display: inline-flex; align-items: center; min-height: 40px; margin-top: 14px; color: var(--m4hse-ink); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #a99f8f; }
.m4hse-link:focus-visible { outline: 2px solid var(--m4hse-focus); outline-offset: 3px; border-radius: 2px; }
.m4hse-sheet { margin: 0; padding: 22px 22px 14px; background: var(--m4hse-sheet); border: 1px solid var(--m4hse-line); border-radius: 3px; box-shadow: 0 1px 0 rgba(47, 46, 43, .05), 0 30px 50px -34px rgba(47, 46, 43, .45); }
.m4hse-art { width: 100%; height: auto; }
.m4hse-art .m4hse-s { stroke: var(--m4hse-pencil); stroke-width: 1.7; }
.m4hse-art .m4hse-thin { stroke-width: 1.05; }
.m4hse-guide .m4hse-s { stroke-width: .8; opacity: .32; }
.m4hse-tree .m4hse-s { stroke-width: 1.3; }
.m4hse-art text { font-family: inherit; font-size: 11px; letter-spacing: .06em; fill: var(--m4hse-quiet); }
.m4hse-cap { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--m4hse-line); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--m4hse-quiet); }
@media (max-width: 760px) {
.m4hse-wrap { grid-template-columns: 1fr; gap: 32px; }
.m4hse-sheet { padding: 14px 12px 10px; }
}
.m4hse[data-run] .m4hse-t0 { animation-delay: 0.00s; }
.m4hse[data-run] .m4hse-t1 { animation-delay: 0.05s; }
.m4hse[data-run] .m4hse-t2 { animation-delay: 0.10s; }
.m4hse[data-run] .m4hse-t3 { animation-delay: 0.14s; }
.m4hse[data-run] .m4hse-t4 { animation-delay: 0.19s; }
.m4hse[data-run] .m4hse-t5 { animation-delay: 0.24s; }
.m4hse[data-run] .m4hse-t6 { animation-delay: 0.29s; }
.m4hse[data-run] .m4hse-t7 { animation-delay: 0.34s; }
.m4hse[data-run] .m4hse-t8 { animation-delay: 0.38s; }
.m4hse[data-run] .m4hse-t9 { animation-delay: 0.43s; }
.m4hse[data-run] .m4hse-t10 { animation-delay: 0.48s; }
.m4hse[data-run] .m4hse-t11 { animation-delay: 0.53s; }
.m4hse[data-run] .m4hse-t12 { animation-delay: 0.58s; }
.m4hse[data-run] .m4hse-t13 { animation-delay: 0.62s; }
.m4hse[data-run] .m4hse-t14 { animation-delay: 0.67s; }
.m4hse[data-run] .m4hse-t15 { animation-delay: 0.72s; }
.m4hse[data-run] .m4hse-t16 { animation-delay: 0.77s; }
.m4hse[data-run] .m4hse-t17 { animation-delay: 0.82s; }
.m4hse[data-run] .m4hse-t18 { animation-delay: 0.86s; }
.m4hse[data-run] .m4hse-t19 { animation-delay: 0.91s; }
.m4hse[data-run] .m4hse-t20 { animation-delay: 0.96s; }
.m4hse[data-run] .m4hse-t21 { animation-delay: 1.01s; }
.m4hse[data-run] .m4hse-t22 { animation-delay: 1.06s; }
.m4hse[data-run] .m4hse-t23 { animation-delay: 1.10s; }
.m4hse[data-run] .m4hse-t24 { animation-delay: 1.15s; }
.m4hse[data-run] .m4hse-t25 { animation-delay: 1.20s; }
.m4hse[data-run] .m4hse-t26 { animation-delay: 1.25s; }
.m4hse[data-run] .m4hse-t27 { animation-delay: 1.30s; }
.m4hse[data-run] .m4hse-t28 { animation-delay: 1.34s; }
.m4hse[data-run] .m4hse-t29 { animation-delay: 1.39s; }
.m4hse[data-run] .m4hse-t30 { animation-delay: 1.44s; }
.m4hse[data-run] .m4hse-t31 { animation-delay: 1.49s; }
.m4hse[data-run] .m4hse-t32 { animation-delay: 1.54s; }
.m4hse[data-run] .m4hse-t33 { animation-delay: 1.58s; }
.m4hse[data-run] .m4hse-t34 { animation-delay: 1.63s; }
.m4hse[data-run] .m4hse-t35 { animation-delay: 1.68s; }
.m4hse[data-run] .m4hse-t36 { animation-delay: 1.73s; }
.m4hse[data-run] .m4hse-t37 { animation-delay: 1.78s; }
.m4hse[data-run] .m4hse-t38 { animation-delay: 1.82s; }
.m4hse[data-run] .m4hse-t39 { animation-delay: 1.87s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4hse").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4hse-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The finished elevation, construction lines and dimension included, is shown from the start.
Running cost: About thirty thin strokes repaint while they draw over roughly 1.6 seconds, a few at a time, then nothing changes.
- Change the graphite colour with `--m4hse-pencil` and the paper with `--m4hse-sheet`.
- Speed the whole sketch up or down by changing the step in the `.m4hse-t` delay rules, which space the strokes 0.048 seconds apart.
Blueprint of a Wooden Side Chair with Dimensions
A workshop drawing for a furniture maker, set on blueprint blue with a faint grid. The floor line comes first, then the chair in front and side elevation, rail by rail and leg by leg, and finally the amber dimension lines with their figures. On phones the title block wraps into two rows under the drawing.
<section class="m4chr">
<figure class="m4chr-sheet">
<figcaption class="m4chr-head">
<p class="m4chr-eyebrow">Ashby Joinery · Workshop drawing</p>
<h2 class="m4chr-h">Side chair No. 4</h2>
</figcaption>
<svg class="m4chr-art" viewBox="0 0 640 410" role="img" aria-label="Blueprint of side chair No. 4 in front and side elevation: 820 millimetres high, 450 to the seat, 440 wide and 500 deep" focusable="false">
<text class="m4chr-f m4chr-t0 m4chr-lbl" x="170" y="36">FRONT ELEVATION</text>
<text class="m4chr-f m4chr-t0 m4chr-lbl" x="438" y="36">SIDE ELEVATION</text>
<path class="m4chr-s m4chr-t0 m4chr-slow m4chr-thin" d="M40 360H600" pathLength="1"/>
<path class="m4chr-s m4chr-t2" d="M124 200V70M216 200V70" pathLength="1"/>
<path class="m4chr-s m4chr-t4" d="M118 70C150 62 190 62 222 70V92C190 84 150 84 118 92Z" pathLength="1"/>
<path class="m4chr-s m4chr-t6 m4chr-thin" d="M146 89V200M170 86.5V200M194 89V200" pathLength="1"/>
<path class="m4chr-s m4chr-t5" d="M110 200H230V214H110Z" pathLength="1"/>
<path class="m4chr-s m4chr-t7" d="M120 214V360M134 214V360M206 214V360M220 214V360" pathLength="1"/>
<path class="m4chr-s m4chr-t9 m4chr-thin" d="M134 312H206M134 320H206" pathLength="1"/>
<path class="m4chr-s m4chr-t3 m4chr-slow" d="M496 360C492 300 490 252 490 204C490 152 482 112 474 66" pathLength="1"/>
<path class="m4chr-s m4chr-t4 m4chr-slow" d="M482 360C478 300 476 252 476 210C476 156 468 116 460 68" pathLength="1"/>
<path class="m4chr-s m4chr-t6" d="M456 62L480 60L486 92L462 95Z" pathLength="1"/>
<path class="m4chr-s m4chr-t8" d="M384 198C420 204 456 204 488 198V212H384Z" pathLength="1"/>
<path class="m4chr-s m4chr-t9" d="M392 212V360M405 212V360" pathLength="1"/>
<path class="m4chr-s m4chr-t11 m4chr-thin" d="M405 314H478M405 322H478" pathLength="1"/>
<g class="m4chr-dim">
<path class="m4chr-s m4chr-t14 m4chr-thin" d="M560 64V360M552 64H568M552 360H568" pathLength="1"/>
<path class="m4chr-s m4chr-t15 m4chr-thin" d="M84 200V360M76 200H92M76 360H92" pathLength="1"/>
<path class="m4chr-s m4chr-t16 m4chr-thin" d="M110 384H230M110 376V392M230 376V392" pathLength="1"/>
<path class="m4chr-s m4chr-t17 m4chr-thin" d="M384 384H496M384 376V392M496 376V392" pathLength="1"/>
<path class="m4chr-s m4chr-t13 m4chr-thin m4chr-faint" d="M486 64H560M230 200H84" pathLength="1"/>
<g transform="rotate(-90 578 212)"><text class="m4chr-f m4chr-t18" x="578" y="212">820</text></g>
<g transform="rotate(-90 70 280)"><text class="m4chr-f m4chr-t19" x="70" y="280">450</text></g>
<text class="m4chr-f m4chr-t20" x="170" y="404">440</text>
<text class="m4chr-f m4chr-t21" x="440" y="404">500</text>
</g>
</svg>
<dl class="m4chr-block">
<div><dt>Timber</dt><dd>Steam-bent ash</dd></div>
<div><dt>Scale</dt><dd>1:10</dd></div>
<div><dt>Units</dt><dd>Millimetres</dd></div>
<div><dt>Sheet</dt><dd>2 of 6</dd></div>
</dl>
</figure>
<button type="button" class="m4chr-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the blueprint blue and line colours at the top of .m4chr, and the dimension figures in the text elements. */
.m4chr { --m4chr-bg: #e6ebf2; --m4chr-blue: #18365f; --m4chr-ink: #eaf1fb; --m4chr-quiet: #b9c8de; --m4chr-line: #3e5f8c; --m4chr-focus: #f3c969; --m4chr-replaybg: #18365f; }
.m4chr { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4chr *, .m4chr *::before, .m4chr *::after { box-sizing: border-box; }
.m4chr svg { display: block; }
.m4chr .m4chr-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4chr-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4chr-line); border-radius: 999px; background: var(--m4chr-replaybg, transparent); color: var(--m4chr-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4chr-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4chr-replay:hover { color: var(--m4chr-ink); }
.m4chr-replay:focus-visible { outline: 2px solid var(--m4chr-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4chr.is-js:not([data-run]) .m4chr-s { stroke-dashoffset: 1; }
.m4chr.is-js:not([data-run]) .m4chr-f { opacity: 0; }
}
.m4chr[data-run] .m4chr-s { animation: m4chr-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4chr[data-run] .m4chr-f { animation: m4chr-fade .5s ease-out both; }
.m4chr[data-run] .m4chr-slow { animation-duration: 1s; }
.m4chr[data-run] .m4chr-quick { animation-duration: .35s; }
@keyframes m4chr-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4chr-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4chr[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4chr *, .m4chr *::before, .m4chr *::after { animation: none !important; transition: none !important; }
.m4chr-replay { display: none; }
}
.m4chr { background: var(--m4chr-bg); padding: 44px clamp(14px, 4vw, 48px) 76px; }
.m4chr-sheet { max-width: 760px; margin: 0 auto; padding: 26px clamp(14px, 3vw, 34px) 0; color: var(--m4chr-ink); border-radius: 6px; background-color: var(--m4chr-blue); background-image: linear-gradient(rgba(234, 241, 251, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(234, 241, 251, .07) 1px, transparent 1px); background-size: 24px 24px; box-shadow: 0 26px 50px -34px rgba(24, 54, 95, .7); overflow: hidden; }
.m4chr-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; padding-bottom: 14px; border-bottom: 1px solid var(--m4chr-line); }
.m4chr-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--m4chr-quiet); }
.m4chr-h { margin: 0; font-size: clamp(22px, 3vw, 28px); font-weight: 650; letter-spacing: -.01em; }
.m4chr-art { width: 100%; height: auto; margin: 10px 0 6px; }
.m4chr-art .m4chr-s { stroke: var(--m4chr-ink); stroke-width: 1.9; }
.m4chr-art .m4chr-thin { stroke-width: 1.1; }
.m4chr-art .m4chr-faint { opacity: .45; }
.m4chr-dim .m4chr-s { stroke: var(--m4chr-focus); }
.m4chr-art text { font-family: inherit; font-size: 15px; font-weight: 600; fill: var(--m4chr-focus); text-anchor: middle; }
.m4chr-art .m4chr-lbl { font-size: 12px; letter-spacing: .16em; fill: var(--m4chr-quiet); }
.m4chr-block { margin: 0 calc(clamp(14px, 3vw, 34px) * -1); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--m4chr-line); }
.m4chr-block div { padding: 12px clamp(14px, 3vw, 34px) 16px; border-left: 1px solid var(--m4chr-line); }
.m4chr-block div:first-child { border-left: 0; }
.m4chr-block dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--m4chr-quiet); }
.m4chr-block dd { margin: 4px 0 0; font-size: 14.5px; font-weight: 600; }
@media (max-width: 640px) {
.m4chr-block { grid-template-columns: 1fr 1fr; }
.m4chr-block div:nth-child(3) { border-left: 0; }
.m4chr-block div:nth-child(n+3) { border-top: 1px solid var(--m4chr-line); }
}
.m4chr[data-run] .m4chr-t0 { animation-delay: 0.00s; }
.m4chr[data-run] .m4chr-t1 { animation-delay: 0.04s; }
.m4chr[data-run] .m4chr-t2 { animation-delay: 0.08s; }
.m4chr[data-run] .m4chr-t3 { animation-delay: 0.11s; }
.m4chr[data-run] .m4chr-t4 { animation-delay: 0.15s; }
.m4chr[data-run] .m4chr-t5 { animation-delay: 0.19s; }
.m4chr[data-run] .m4chr-t6 { animation-delay: 0.23s; }
.m4chr[data-run] .m4chr-t7 { animation-delay: 0.27s; }
.m4chr[data-run] .m4chr-t8 { animation-delay: 0.30s; }
.m4chr[data-run] .m4chr-t9 { animation-delay: 0.34s; }
.m4chr[data-run] .m4chr-t10 { animation-delay: 0.38s; }
.m4chr[data-run] .m4chr-t11 { animation-delay: 0.42s; }
.m4chr[data-run] .m4chr-t12 { animation-delay: 0.46s; }
.m4chr[data-run] .m4chr-t13 { animation-delay: 0.49s; }
.m4chr[data-run] .m4chr-t14 { animation-delay: 0.53s; }
.m4chr[data-run] .m4chr-t15 { animation-delay: 0.57s; }
.m4chr[data-run] .m4chr-t16 { animation-delay: 0.61s; }
.m4chr[data-run] .m4chr-t17 { animation-delay: 0.65s; }
.m4chr[data-run] .m4chr-t18 { animation-delay: 0.68s; }
.m4chr[data-run] .m4chr-t19 { animation-delay: 0.72s; }
.m4chr[data-run] .m4chr-t20 { animation-delay: 0.76s; }
.m4chr[data-run] .m4chr-t21 { animation-delay: 0.80s; }
.m4chr[data-run] .m4chr-t22 { animation-delay: 0.84s; }
.m4chr[data-run] .m4chr-t23 { animation-delay: 0.87s; }
.m4chr[data-run] .m4chr-t24 { animation-delay: 0.91s; }
.m4chr[data-run] .m4chr-t25 { animation-delay: 0.95s; }
.m4chr[data-run] .m4chr-t26 { animation-delay: 0.99s; }
.m4chr[data-run] .m4chr-t27 { animation-delay: 1.03s; }
.m4chr[data-run] .m4chr-t28 { animation-delay: 1.06s; }
.m4chr[data-run] .m4chr-t29 { animation-delay: 1.10s; }
.m4chr[data-run] .m4chr-t30 { animation-delay: 1.14s; }
.m4chr[data-run] .m4chr-t31 { animation-delay: 1.18s; }
.m4chr[data-run] .m4chr-t32 { animation-delay: 1.22s; }
.m4chr[data-run] .m4chr-t33 { animation-delay: 1.25s; }
.m4chr[data-run] .m4chr-t34 { animation-delay: 1.29s; }
.m4chr[data-run] .m4chr-t35 { animation-delay: 1.33s; }
.m4chr[data-run] .m4chr-t36 { animation-delay: 1.37s; }
.m4chr[data-run] .m4chr-t37 { animation-delay: 1.41s; }
.m4chr[data-run] .m4chr-t38 { animation-delay: 1.44s; }
.m4chr[data-run] .m4chr-t39 { animation-delay: 1.48s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4chr").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4chr-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The complete blueprint with all dimensions is shown without drawing.
Running cost: Around twenty strokes repaint in a 1.5 second stagger, then the sheet never changes.
- Change the paper with `--m4chr-blue` and the dimension colour with `--m4chr-focus`.
- Edit the figures in the four `text` elements and the `aria-label` together so the drawing and its description agree.
Botanical Olive Sprig Line Illustration
A product card for a small apothecary with an olive sprig drawn in one green ink. The stem grows from the bottom first and each pair of leaves outlines itself as the stem passes, then the midribs, two small olives and the Latin name follow. On phones the drawing sits above the product notes.
<section class="m4bot">
<article class="m4bot-card">
<div class="m4bot-plate">
<svg class="m4bot-art" viewBox="0 0 420 470" aria-hidden="true" focusable="false">
<path class="m4bot-s m4bot-t0 m4bot-slow m4bot-stem" d="M196 446C176 330 250 210 226 48" pathLength="1"/>
<g>
<path class="m4bot-s m4bot-t4 m4bot-leaf" d="M192.5 404.0C156.7 406.3 123.7 372.8 111.2 338.0C141.1 345.3 179.1 370.8 192.5 404.0" pathLength="1"/>
<path class="m4bot-s m4bot-t9 m4bot-quick m4bot-rib" d="M187.3 400.6Q153.4 378.3 121.8 348.5" pathLength="1"/>
<path class="m4bot-s m4bot-t5 m4bot-leaf" d="M193.7 375.6C228.7 379.1 265.0 355.7 282.4 332.1C248.1 329.7 206.9 345.5 193.7 375.6" pathLength="1"/>
<path class="m4bot-s m4bot-t10 m4bot-quick m4bot-rib" d="M198.7 372.5Q232.9 354.9 269.2 337.0" pathLength="1"/>
<path class="m4bot-s m4bot-t6 m4bot-leaf" d="M198.2 339.5C166.2 331.7 145.9 293.3 144.0 259.4C168.2 274.0 194.9 306.8 198.2 339.5" pathLength="1"/>
<path class="m4bot-s m4bot-t11 m4bot-quick m4bot-rib" d="M194.5 335.1Q170.5 306.3 150.5 271.5" pathLength="1"/>
<path class="m4bot-s m4bot-t8 m4bot-leaf" d="M203.4 309.9C236.3 313.3 270.3 291.2 286.5 268.9C254.2 266.6 215.6 281.5 203.4 309.9" pathLength="1"/>
<path class="m4bot-s m4bot-t13 m4bot-quick m4bot-rib" d="M208.0 307.0Q240.1 290.5 274.1 273.5" pathLength="1"/>
<path class="m4bot-s m4bot-t9 m4bot-leaf" d="M210.9 272.0C182.7 261.4 170.0 224.7 173.3 194.0C193.5 209.7 213.1 242.1 210.9 272.0" pathLength="1"/>
<path class="m4bot-s m4bot-t14 m4bot-quick m4bot-rib" d="M208.2 267.6Q190.6 239.0 177.5 205.6" pathLength="1"/>
<path class="m4bot-s m4bot-t10 m4bot-leaf" d="M217.1 240.7C247.1 240.2 275.8 216.9 288.5 195.2C259.1 196.5 225.6 213.9 217.1 240.7" pathLength="1"/>
<path class="m4bot-s m4bot-t15 m4bot-quick m4bot-rib" d="M221.0 237.5Q248.5 219.3 277.7 200.6" pathLength="1"/>
<path class="m4bot-s m4bot-t12 m4bot-leaf" d="M223.4 204.3C199.0 193.7 189.5 160.6 194.0 133.6C211.1 148.4 226.8 177.9 223.4 204.3" pathLength="1"/>
<path class="m4bot-s m4bot-t17 m4bot-quick m4bot-rib" d="M221.2 200.3Q207.1 174.2 197.2 144.0" pathLength="1"/>
<path class="m4bot-s m4bot-t13 m4bot-leaf" d="M227.8 170.8C252.9 166.2 272.6 142.5 279.0 122.4C254.7 127.6 229.9 147.0 227.8 170.8" pathLength="1"/>
<path class="m4bot-s m4bot-t18 m4bot-quick m4bot-rib" d="M230.5 167.6Q250.2 148.4 271.1 128.5" pathLength="1"/>
<path class="m4bot-s m4bot-t14 m4bot-leaf" d="M230.4 136.1C210.7 126.8 203.8 99.6 208.1 77.7C221.6 90.2 233.7 114.7 230.4 136.1" pathLength="1"/>
<path class="m4bot-s m4bot-t19 m4bot-quick m4bot-rib" d="M228.7 132.7Q217.8 111.2 210.4 86.3" pathLength="1"/>
<path class="m4bot-s m4bot-t15 m4bot-leaf" d="M230.7 104.6C248.9 96.2 258.7 74.6 259.0 58.1C241.7 66.9 227.1 86.3 230.7 104.6" pathLength="1"/>
<path class="m4bot-s m4bot-t20 m4bot-quick m4bot-rib" d="M232.1 101.6Q242.9 83.4 254.4 64.3" pathLength="1"/>
<path class="m4bot-s m4bot-t16 m4bot-leaf" d="M228.9 72.0C215.2 64.8 212.7 45.9 218.1 31.1C227.1 40.2 233.8 57.4 228.9 72.0" pathLength="1"/>
<path class="m4bot-s m4bot-t21 m4bot-quick m4bot-rib" d="M228.0 69.6Q222.1 54.3 219.0 37.0" pathLength="1"/>
</g>
<path class="m4bot-s m4bot-t9 m4bot-twig" d="M207.1 291.1C219.1 293.1 233.1 301.1 237.1 313.1" pathLength="1"/>
<ellipse class="m4bot-s m4bot-t13 m4bot-fruit" cx="238.6" cy="324.1" rx="8.5" ry="11.5" transform="rotate(-14 238.6 324.1)" pathLength="1"/>
<path class="m4bot-s m4bot-t12 m4bot-twig" d="M220.0 224.7C208.0 226.7 194.0 234.7 190.0 246.7" pathLength="1"/>
<ellipse class="m4bot-s m4bot-t16 m4bot-fruit" cx="188.5" cy="257.7" rx="8.5" ry="11.5" transform="rotate(14 188.5 257.7)" pathLength="1"/>
</svg>
<p class="m4bot-latin m4bot-f m4bot-t16">Olea europaea</p>
</div>
<div class="m4bot-body">
<p class="m4bot-eyebrow">Grove Street Apothecary</p>
<h2 class="m4bot-h">Olive Leaf Hand Balm</h2>
<p class="m4bot-p">A soft balm of olive leaf, beeswax and a little lemon peel, poured by hand in small tins at the back of the shop on Grove Street.</p>
<ul class="m4bot-notes">
<li>Olive leaf infused oil</li>
<li>Local beeswax</li>
<li>Lemon peel</li>
</ul>
<a class="m4bot-btn" href="#">Read the ingredients</a>
</div>
</article>
<button type="button" class="m4bot-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the leaf green and card colours at the top of .m4bot, and the leaf list in the source if you redraw the sprig. */
.m4bot { --m4bot-bg: #e9e3d3; --m4bot-card: #f6f2e7; --m4bot-ink: #24322a; --m4bot-quiet: #4f5b52; --m4bot-line: #d6cfbd; --m4bot-focus: #2f5a43; --m4bot-leaf: #2f5a43; --m4bot-fruit: #6b5a3a; }
.m4bot { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4bot *, .m4bot *::before, .m4bot *::after { box-sizing: border-box; }
.m4bot svg { display: block; }
.m4bot .m4bot-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4bot-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4bot-line); border-radius: 999px; background: var(--m4bot-replaybg, transparent); color: var(--m4bot-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4bot-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4bot-replay:hover { color: var(--m4bot-ink); }
.m4bot-replay:focus-visible { outline: 2px solid var(--m4bot-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4bot.is-js:not([data-run]) .m4bot-s { stroke-dashoffset: 1; }
.m4bot.is-js:not([data-run]) .m4bot-f { opacity: 0; }
}
.m4bot[data-run] .m4bot-s { animation: m4bot-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4bot[data-run] .m4bot-f { animation: m4bot-fade .5s ease-out both; }
.m4bot[data-run] .m4bot-slow { animation-duration: 1s; }
.m4bot[data-run] .m4bot-quick { animation-duration: .35s; }
@keyframes m4bot-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4bot-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4bot[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4bot *, .m4bot *::before, .m4bot *::after { animation: none !important; transition: none !important; }
.m4bot-replay { display: none; }
}
.m4bot { background: var(--m4bot-bg); color: var(--m4bot-ink); padding: 52px clamp(16px, 5vw, 56px) 76px; }
.m4bot-card { max-width: 920px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--m4bot-card); border: 1px solid var(--m4bot-line); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 60px -40px rgba(36, 50, 42, .5); }
.m4bot-plate { position: relative; padding: 28px 24px 44px; border-right: 1px solid var(--m4bot-line); }
.m4bot-art { width: 100%; max-width: 360px; height: auto; margin: 0 auto; }
.m4bot-art .m4bot-s { stroke: var(--m4bot-leaf); stroke-width: 1.8; }
.m4bot-art .m4bot-stem { stroke-width: 2.3; }
.m4bot-art .m4bot-rib { stroke-width: 1.1; opacity: .8; }
.m4bot-art .m4bot-twig { stroke-width: 1.5; }
.m4bot-art .m4bot-fruit { stroke: var(--m4bot-fruit); stroke-width: 1.7; }
.m4bot-latin { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; text-align: center; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 14px; color: var(--m4bot-quiet); }
.m4bot-body { padding: 44px 40px; align-self: center; }
.m4bot-eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--m4bot-focus); }
.m4bot-h { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(30px, 3.6vw, 40px); line-height: 1.08; }
.m4bot-p { margin: 16px 0 0; font-size: 15.5px; line-height: 1.65; color: var(--m4bot-quiet); }
.m4bot-notes { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14.5px; }
.m4bot-notes li { display: flex; gap: 10px; align-items: center; }
.m4bot-notes li::before { content: ""; width: 14px; height: 2px; background: var(--m4bot-leaf); flex: none; }
.m4bot-btn { display: inline-flex; align-items: center; min-height: 44px; margin-top: 26px; padding: 0 22px; border-radius: 999px; background: var(--m4bot-leaf); color: #f6f2e7; font-weight: 600; font-size: 14.5px; text-decoration: none; }
.m4bot-btn:hover { background: #24493a; }
.m4bot-btn:focus-visible { outline: 2px solid var(--m4bot-focus); outline-offset: 3px; }
@media (max-width: 720px) {
.m4bot-card { grid-template-columns: 1fr; }
.m4bot-plate { border-right: 0; border-bottom: 1px solid var(--m4bot-line); }
.m4bot-art { max-width: 260px; }
.m4bot-body { padding: 30px 24px 36px; }
}
.m4bot[data-run] .m4bot-t0 { animation-delay: 0.00s; }
.m4bot[data-run] .m4bot-t1 { animation-delay: 0.06s; }
.m4bot[data-run] .m4bot-t2 { animation-delay: 0.12s; }
.m4bot[data-run] .m4bot-t3 { animation-delay: 0.18s; }
.m4bot[data-run] .m4bot-t4 { animation-delay: 0.24s; }
.m4bot[data-run] .m4bot-t5 { animation-delay: 0.30s; }
.m4bot[data-run] .m4bot-t6 { animation-delay: 0.36s; }
.m4bot[data-run] .m4bot-t7 { animation-delay: 0.42s; }
.m4bot[data-run] .m4bot-t8 { animation-delay: 0.48s; }
.m4bot[data-run] .m4bot-t9 { animation-delay: 0.54s; }
.m4bot[data-run] .m4bot-t10 { animation-delay: 0.60s; }
.m4bot[data-run] .m4bot-t11 { animation-delay: 0.66s; }
.m4bot[data-run] .m4bot-t12 { animation-delay: 0.72s; }
.m4bot[data-run] .m4bot-t13 { animation-delay: 0.78s; }
.m4bot[data-run] .m4bot-t14 { animation-delay: 0.84s; }
.m4bot[data-run] .m4bot-t15 { animation-delay: 0.90s; }
.m4bot[data-run] .m4bot-t16 { animation-delay: 0.96s; }
.m4bot[data-run] .m4bot-t17 { animation-delay: 1.02s; }
.m4bot[data-run] .m4bot-t18 { animation-delay: 1.08s; }
.m4bot[data-run] .m4bot-t19 { animation-delay: 1.14s; }
.m4bot[data-run] .m4bot-t20 { animation-delay: 1.20s; }
.m4bot[data-run] .m4bot-t21 { animation-delay: 1.26s; }
.m4bot[data-run] .m4bot-t22 { animation-delay: 1.32s; }
.m4bot[data-run] .m4bot-t23 { animation-delay: 1.38s; }
.m4bot[data-run] .m4bot-t24 { animation-delay: 1.44s; }
.m4bot[data-run] .m4bot-t25 { animation-delay: 1.50s; }
.m4bot[data-run] .m4bot-t26 { animation-delay: 1.56s; }
.m4bot[data-run] .m4bot-t27 { animation-delay: 1.62s; }
.m4bot[data-run] .m4bot-t28 { animation-delay: 1.68s; }
.m4bot[data-run] .m4bot-t29 { animation-delay: 1.74s; }
.m4bot[data-run] .m4bot-t30 { animation-delay: 1.80s; }
.m4bot[data-run] .m4bot-t31 { animation-delay: 1.86s; }
.m4bot[data-run] .m4bot-t32 { animation-delay: 1.92s; }
.m4bot[data-run] .m4bot-t33 { animation-delay: 1.98s; }
.m4bot[data-run] .m4bot-t34 { animation-delay: 2.04s; }
.m4bot[data-run] .m4bot-t35 { animation-delay: 2.10s; }
.m4bot[data-run] .m4bot-t36 { animation-delay: 2.16s; }
.m4bot[data-run] .m4bot-t37 { animation-delay: 2.22s; }
.m4bot[data-run] .m4bot-t38 { animation-delay: 2.28s; }
.m4bot[data-run] .m4bot-t39 { animation-delay: 2.34s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4bot").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4bot-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The full sprig with leaves, olives and caption is drawn and still.
Running cost: Twenty-odd short leaf strokes repaint while drawing for about 1.5 seconds, then the card is static.
- Recolour the leaves with `--m4bot-leaf` and the olives with `--m4bot-fruit`.
- Each leaf is one closed path and its midrib is a second path; delete a pair or move its `.m4bot-t` delay class to change the rhythm.
Coffee Cup Spot Illustration with Rising Steam
An opening hours card for a café with a cup and saucer drawn in brown ink. The saucer, cup, rim, coffee and handle draw in once, then three strands of steam rise in a slow loop, each one drawing up from the cup and erasing from its base before the next takes over. On phones the cup sits above the hours.
<section class="m4cof">
<article class="m4cof-card">
<div class="m4cof-spot">
<svg class="m4cof-art" viewBox="0 0 300 290" aria-hidden="true" focusable="false">
<g class="m4cof-steam m4cof-f m4cof-t16">
<path d="M128 110C118 94 138 84 128 64C120 48 134 40 130 28" pathLength="1"/>
<path d="M151 106C161 90 141 78 153 58C161 44 149 34 155 22" pathLength="1"/>
<path d="M173 110C163 96 181 86 173 68C167 56 177 48 173 38" pathLength="1"/>
</g>
<ellipse class="m4cof-s m4cof-t0 m4cof-slow" cx="150" cy="232" rx="106" ry="24" pathLength="1"/>
<ellipse class="m4cof-s m4cof-t3 m4cof-thin" cx="150" cy="229" rx="64" ry="12" pathLength="1"/>
<path class="m4cof-cupfill" d="M86 130C88 196 110 226 150 226C190 226 212 196 214 130Z"/>
<path class="m4cof-s m4cof-t2 m4cof-slow" d="M86 130C88 196 110 226 150 226C190 226 212 196 214 130" pathLength="1"/>
<ellipse class="m4cof-s m4cof-t5" cx="150" cy="130" rx="64" ry="14" pathLength="1"/>
<ellipse class="m4cof-s m4cof-t8 m4cof-thin m4cof-coffee" cx="150" cy="133" rx="53" ry="9.5" pathLength="1"/>
<path class="m4cof-s m4cof-t11 m4cof-quick m4cof-thin m4cof-coffee" d="M128 134C140 128 160 139 172 132" pathLength="1"/>
<path class="m4cof-s m4cof-t7" d="M212 150C242 144 248 178 222 188C216 190 209 192 204 194" pathLength="1"/>
<path class="m4cof-s m4cof-t9 m4cof-thin" d="M211 161C228 158 231 174 217 179" pathLength="1"/>
<path class="m4cof-s m4cof-t12 m4cof-thin m4cof-shade" d="M200 152C199 178 192 198 178 212M190 160C189 178 184 192 174 204" pathLength="1"/>
</svg>
</div>
<div class="m4cof-body">
<p class="m4cof-eyebrow">Kettle & Crumb · Albion Row</p>
<h2 class="m4cof-h">Open from seven</h2>
<p class="m4cof-p">Filter coffee, cardamom buns and a corner table by the window. Bring a book; nobody will hurry you.</p>
<dl class="m4cof-hours">
<div><dt>Monday to Friday</dt><dd>7:00 to 16:00</dd></div>
<div><dt>Saturday</dt><dd>8:00 to 15:00</dd></div>
<div><dt>Sunday</dt><dd>Closed</dd></div>
</dl>
<a class="m4cof-link" href="#">How to find us</a>
</div>
</article>
<button type="button" class="m4cof-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the oat, ink and coffee colours at the top of .m4cof, and --m4cof-steam-time for the speed of the steam loop. */
.m4cof { --m4cof-bg: #efe4d2; --m4cof-card: #faf5ec; --m4cof-ink: #33241b; --m4cof-quiet: #66554a; --m4cof-line: #e0d2bd; --m4cof-focus: #8a5a3b; --m4cof-pen: #3a2a20; --m4cof-coffee: #8a5a3b; --m4cof-steam-time: 5.6s; }
.m4cof { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4cof *, .m4cof *::before, .m4cof *::after { box-sizing: border-box; }
.m4cof svg { display: block; }
.m4cof .m4cof-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4cof-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4cof-line); border-radius: 999px; background: var(--m4cof-replaybg, transparent); color: var(--m4cof-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4cof-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4cof-replay:hover { color: var(--m4cof-ink); }
.m4cof-replay:focus-visible { outline: 2px solid var(--m4cof-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4cof.is-js:not([data-run]) .m4cof-s { stroke-dashoffset: 1; }
.m4cof.is-js:not([data-run]) .m4cof-f { opacity: 0; }
}
.m4cof[data-run] .m4cof-s { animation: m4cof-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4cof[data-run] .m4cof-f { animation: m4cof-fade .5s ease-out both; }
.m4cof[data-run] .m4cof-slow { animation-duration: 1s; }
.m4cof[data-run] .m4cof-quick { animation-duration: .35s; }
@keyframes m4cof-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4cof-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4cof[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4cof *, .m4cof *::before, .m4cof *::after { animation: none !important; transition: none !important; }
.m4cof-replay { display: none; }
}
.m4cof { background: var(--m4cof-bg); color: var(--m4cof-ink); padding: 52px clamp(16px, 5vw, 56px) 76px; }
.m4cof-card { max-width: 860px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; background: var(--m4cof-card); border: 1px solid var(--m4cof-line); border-radius: 20px; box-shadow: 0 28px 56px -40px rgba(51, 36, 27, .5); }
.m4cof-spot { padding: 30px 26px; }
.m4cof-art { width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.m4cof-art .m4cof-s { stroke: var(--m4cof-pen); stroke-width: 2.1; }
.m4cof-art .m4cof-thin { stroke-width: 1.4; }
.m4cof-art .m4cof-coffee { stroke: var(--m4cof-coffee); }
.m4cof-art .m4cof-shade { opacity: .55; }
.m4cof-art .m4cof-cupfill { fill: var(--m4cof-card); }
.m4cof-steam path { fill: none; stroke: var(--m4cof-coffee); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 1 2; stroke-dashoffset: 0; opacity: .7; transform-box: fill-box; transform-origin: 50% 100%; }
/* The steam loop: each strand draws up from the cup, then erases from its base and drifts away. */
@media (prefers-reduced-motion: no-preference) {
.m4cof-steam path { animation: m4cof-rise var(--m4cof-steam-time) ease-in-out infinite; }
.m4cof-steam path:nth-child(2) { animation-delay: calc(var(--m4cof-steam-time) / -3); }
.m4cof-steam path:nth-child(3) { animation-delay: calc(var(--m4cof-steam-time) / -1.5); }
.m4cof.is-js:not([data-run]) .m4cof-steam path { animation-play-state: paused; }
}
@keyframes m4cof-rise {
0% { stroke-dashoffset: 1; opacity: 0; transform: translateY(6px); }
18% { opacity: .75; }
50% { stroke-dashoffset: 0; }
82% { opacity: .55; }
100% { stroke-dashoffset: -1; opacity: 0; transform: translateY(-10px); }
}
.m4cof-body { padding: 36px 40px 40px 8px; }
.m4cof-eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--m4cof-coffee); }
.m4cof-h { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(30px, 3.8vw, 42px); line-height: 1.05; }
.m4cof-p { margin: 14px 0 0; font-size: 15.5px; line-height: 1.6; color: var(--m4cof-quiet); }
.m4cof-hours { margin: 20px 0 0; display: grid; }
.m4cof-hours div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--m4cof-line); font-size: 14.5px; }
.m4cof-hours dt { color: var(--m4cof-quiet); }
.m4cof-hours dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.m4cof-link { display: inline-flex; align-items: center; min-height: 40px; margin-top: 12px; color: var(--m4cof-ink); font-weight: 650; font-size: 14.5px; text-underline-offset: 5px; text-decoration-color: var(--m4cof-coffee); }
.m4cof-link:focus-visible { outline: 2px solid var(--m4cof-focus); outline-offset: 3px; border-radius: 2px; }
@media (max-width: 700px) {
.m4cof-card { grid-template-columns: 1fr; }
.m4cof-spot { padding: 26px 26px 0; }
.m4cof-art { max-width: 220px; }
.m4cof-body { padding: 18px 24px 34px; }
}
.m4cof[data-run] .m4cof-t0 { animation-delay: 0.00s; }
.m4cof[data-run] .m4cof-t1 { animation-delay: 0.05s; }
.m4cof[data-run] .m4cof-t2 { animation-delay: 0.10s; }
.m4cof[data-run] .m4cof-t3 { animation-delay: 0.15s; }
.m4cof[data-run] .m4cof-t4 { animation-delay: 0.20s; }
.m4cof[data-run] .m4cof-t5 { animation-delay: 0.25s; }
.m4cof[data-run] .m4cof-t6 { animation-delay: 0.30s; }
.m4cof[data-run] .m4cof-t7 { animation-delay: 0.35s; }
.m4cof[data-run] .m4cof-t8 { animation-delay: 0.40s; }
.m4cof[data-run] .m4cof-t9 { animation-delay: 0.45s; }
.m4cof[data-run] .m4cof-t10 { animation-delay: 0.50s; }
.m4cof[data-run] .m4cof-t11 { animation-delay: 0.55s; }
.m4cof[data-run] .m4cof-t12 { animation-delay: 0.60s; }
.m4cof[data-run] .m4cof-t13 { animation-delay: 0.65s; }
.m4cof[data-run] .m4cof-t14 { animation-delay: 0.70s; }
.m4cof[data-run] .m4cof-t15 { animation-delay: 0.75s; }
.m4cof[data-run] .m4cof-t16 { animation-delay: 0.80s; }
.m4cof[data-run] .m4cof-t17 { animation-delay: 0.85s; }
.m4cof[data-run] .m4cof-t18 { animation-delay: 0.90s; }
.m4cof[data-run] .m4cof-t19 { animation-delay: 0.95s; }
.m4cof[data-run] .m4cof-t20 { animation-delay: 1.00s; }
.m4cof[data-run] .m4cof-t21 { animation-delay: 1.05s; }
.m4cof[data-run] .m4cof-t22 { animation-delay: 1.10s; }
.m4cof[data-run] .m4cof-t23 { animation-delay: 1.15s; }
.m4cof[data-run] .m4cof-t24 { animation-delay: 1.20s; }
.m4cof[data-run] .m4cof-t25 { animation-delay: 1.25s; }
.m4cof[data-run] .m4cof-t26 { animation-delay: 1.30s; }
.m4cof[data-run] .m4cof-t27 { animation-delay: 1.35s; }
.m4cof[data-run] .m4cof-t28 { animation-delay: 1.40s; }
.m4cof[data-run] .m4cof-t29 { animation-delay: 1.45s; }
.m4cof[data-run] .m4cof-t30 { animation-delay: 1.50s; }
.m4cof[data-run] .m4cof-t31 { animation-delay: 1.55s; }
.m4cof[data-run] .m4cof-t32 { animation-delay: 1.60s; }
.m4cof[data-run] .m4cof-t33 { animation-delay: 1.65s; }
.m4cof[data-run] .m4cof-t34 { animation-delay: 1.70s; }
.m4cof[data-run] .m4cof-t35 { animation-delay: 1.75s; }
.m4cof[data-run] .m4cof-t36 { animation-delay: 1.80s; }
.m4cof[data-run] .m4cof-t37 { animation-delay: 1.85s; }
.m4cof[data-run] .m4cof-t38 { animation-delay: 1.90s; }
.m4cof[data-run] .m4cof-t39 { animation-delay: 1.95s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4cof").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4cof-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The cup is drawn and the three steam strands stand still at soft opacity.
Running cost: After the one-time drawing, three short steam strokes repaint in a slow loop that pauses off screen.
- Slow or speed the steam with `--m4cof-steam-time`; the three strands stay a third of a cycle apart.
- Change the ink with `--m4cof-pen` and the coffee and steam colour with `--m4cof-coffee`.
Empty Inbox State with Tray and Paper Plane
An empty inbox inside a small mail app. The open tray is drawn first, then a looping flight trail and a paper plane leaving it, while the heading, sentence and two actions sit still beside the drawing. On phones the folder list becomes a row above the message pane.
<section class="m4inb">
<div class="m4inb-app">
<nav class="m4inb-side" aria-label="Mail folders">
<p class="m4inb-brand">Juniper Print Co.</p>
<ul>
<li><a href="#" aria-current="page">Inbox</a></li>
<li><a href="#">Sent</a></li>
<li><a href="#">Drafts</a></li>
<li><a href="#">Archive</a></li>
</ul>
</nav>
<main class="m4inb-main">
<div class="m4inb-bar"><h2 class="m4inb-title">Inbox</h2><span class="m4inb-count">0 messages</span></div>
<div class="m4inb-empty">
<svg class="m4inb-art" viewBox="0 0 240 170" aria-hidden="true" focusable="false">
<path class="m4inb-s m4inb-t0 m4inb-thin m4inb-ground" d="M30 152H210" pathLength="1"/>
<path class="m4inb-s m4inb-t1" d="M62 94H178" pathLength="1"/>
<path class="m4inb-s m4inb-t2 m4inb-quick" d="M62 94L46 114M178 94L194 114" pathLength="1"/>
<path class="m4inb-s m4inb-t3 m4inb-slow" d="M46 114H96L103 124H137L144 114H194V136C194 140.4 190.4 144 186 144H54C49.6 144 46 140.4 46 136Z" pathLength="1"/>
<path class="m4inb-s m4inb-t6 m4inb-thin" d="M70 104H170" pathLength="1"/>
<path class="m4inb-s m4inb-t7 m4inb-slow m4inb-thin m4inb-trail" d="M56 76C72 74 86 60 102 62C116 64 116 80 104 80C92 80 98 60 124 54C134 52 142 51 150 50" pathLength="1"/>
<path class="m4inb-s m4inb-t13 m4inb-plane" d="M150 50L204 26L184 70L170 58Z" pathLength="1"/>
<path class="m4inb-s m4inb-t16 m4inb-quick m4inb-plane" d="M170 58L204 26M170 58L168 72L176 64" pathLength="1"/>
</svg>
<h3 class="m4inb-h">Your inbox is clear</h3>
<p class="m4inb-p">Messages from your print customers will land here. Nothing is waiting for a reply right now.</p>
<div class="m4inb-actions">
<a class="m4inb-btn" href="#">Write a message</a>
<a class="m4inb-ghost" href="#">Open the archive</a>
</div>
</div>
</main>
</div>
<button type="button" class="m4inb-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the slate and teal colours at the top of .m4inb, and the heading and sentence of the empty state. */
.m4inb { --m4inb-bg: #eef1f4; --m4inb-panel: #ffffff; --m4inb-ink: #1e293b; --m4inb-quiet: #526071; --m4inb-line: #e2e7ee; --m4inb-focus: #2b6f77; --m4inb-pen: #334155; --m4inb-accent: #2b6f77; }
.m4inb { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4inb *, .m4inb *::before, .m4inb *::after { box-sizing: border-box; }
.m4inb svg { display: block; }
.m4inb .m4inb-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4inb-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4inb-line); border-radius: 999px; background: var(--m4inb-replaybg, transparent); color: var(--m4inb-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4inb-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4inb-replay:hover { color: var(--m4inb-ink); }
.m4inb-replay:focus-visible { outline: 2px solid var(--m4inb-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4inb.is-js:not([data-run]) .m4inb-s { stroke-dashoffset: 1; }
.m4inb.is-js:not([data-run]) .m4inb-f { opacity: 0; }
}
.m4inb[data-run] .m4inb-s { animation: m4inb-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4inb[data-run] .m4inb-f { animation: m4inb-fade .5s ease-out both; }
.m4inb[data-run] .m4inb-slow { animation-duration: 1s; }
.m4inb[data-run] .m4inb-quick { animation-duration: .35s; }
@keyframes m4inb-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4inb-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4inb[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4inb *, .m4inb *::before, .m4inb *::after { animation: none !important; transition: none !important; }
.m4inb-replay { display: none; }
}
.m4inb { background: var(--m4inb-bg); color: var(--m4inb-ink); padding: 40px clamp(14px, 4vw, 48px) 76px; }
.m4inb-app { max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: 210px minmax(0, 1fr); background: var(--m4inb-panel); border: 1px solid var(--m4inb-line); border-radius: 14px; overflow: hidden; box-shadow: 0 22px 44px -32px rgba(30, 41, 59, .4); }
.m4inb-side { padding: 22px 14px; background: #f7f9fb; border-right: 1px solid var(--m4inb-line); }
.m4inb-brand { margin: 0 10px 18px; font-weight: 700; font-size: 15px; }
.m4inb-side ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.m4inb-side a { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--m4inb-quiet); font-size: 14.5px; text-decoration: none; }
.m4inb-side a[aria-current] { background: #e4eef0; color: var(--m4inb-accent); font-weight: 650; }
.m4inb-side a:hover { color: var(--m4inb-ink); }
.m4inb a:focus-visible { outline: 2px solid var(--m4inb-focus); outline-offset: 2px; }
.m4inb-main { min-width: 0; }
.m4inb-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 26px; border-bottom: 1px solid var(--m4inb-line); }
.m4inb-title { margin: 0; font-size: 18px; font-weight: 700; }
.m4inb-count { font-size: 13.5px; color: var(--m4inb-quiet); }
.m4inb-empty { padding: 40px 24px 52px; text-align: center; }
.m4inb-art { width: 250px; max-width: 72%; height: auto; margin: 0 auto 14px; }
.m4inb-art .m4inb-s { stroke: var(--m4inb-pen); stroke-width: 2; }
.m4inb-art .m4inb-thin { stroke-width: 1.3; }
.m4inb-art .m4inb-ground { opacity: .35; }
.m4inb-art .m4inb-trail { stroke: var(--m4inb-accent); opacity: .7; }
.m4inb-art .m4inb-plane { stroke: var(--m4inb-accent); }
.m4inb-h { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.m4inb-p { margin: 8px auto 0; max-width: 25em; font-size: 15px; line-height: 1.55; color: var(--m4inb-quiet); }
.m4inb-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.m4inb-btn, .m4inb-ghost { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 10px; font-size: 14.5px; font-weight: 650; text-decoration: none; }
.m4inb-btn { background: var(--m4inb-accent); color: #fff; }
.m4inb-btn:hover { background: #235c63; }
.m4inb-ghost { color: var(--m4inb-ink); border: 1px solid #cbd3dd; }
@media (max-width: 680px) {
.m4inb-app { grid-template-columns: 1fr; }
.m4inb-side { border-right: 0; border-bottom: 1px solid var(--m4inb-line); padding: 14px; }
.m4inb-brand { margin-bottom: 10px; }
.m4inb-side ul { grid-auto-flow: column; overflow-x: auto; }
}
.m4inb[data-run] .m4inb-t0 { animation-delay: 0.00s; }
.m4inb[data-run] .m4inb-t1 { animation-delay: 0.05s; }
.m4inb[data-run] .m4inb-t2 { animation-delay: 0.10s; }
.m4inb[data-run] .m4inb-t3 { animation-delay: 0.15s; }
.m4inb[data-run] .m4inb-t4 { animation-delay: 0.20s; }
.m4inb[data-run] .m4inb-t5 { animation-delay: 0.25s; }
.m4inb[data-run] .m4inb-t6 { animation-delay: 0.30s; }
.m4inb[data-run] .m4inb-t7 { animation-delay: 0.35s; }
.m4inb[data-run] .m4inb-t8 { animation-delay: 0.40s; }
.m4inb[data-run] .m4inb-t9 { animation-delay: 0.45s; }
.m4inb[data-run] .m4inb-t10 { animation-delay: 0.50s; }
.m4inb[data-run] .m4inb-t11 { animation-delay: 0.55s; }
.m4inb[data-run] .m4inb-t12 { animation-delay: 0.60s; }
.m4inb[data-run] .m4inb-t13 { animation-delay: 0.65s; }
.m4inb[data-run] .m4inb-t14 { animation-delay: 0.70s; }
.m4inb[data-run] .m4inb-t15 { animation-delay: 0.75s; }
.m4inb[data-run] .m4inb-t16 { animation-delay: 0.80s; }
.m4inb[data-run] .m4inb-t17 { animation-delay: 0.85s; }
.m4inb[data-run] .m4inb-t18 { animation-delay: 0.90s; }
.m4inb[data-run] .m4inb-t19 { animation-delay: 0.95s; }
.m4inb[data-run] .m4inb-t20 { animation-delay: 1.00s; }
.m4inb[data-run] .m4inb-t21 { animation-delay: 1.05s; }
.m4inb[data-run] .m4inb-t22 { animation-delay: 1.10s; }
.m4inb[data-run] .m4inb-t23 { animation-delay: 1.15s; }
.m4inb[data-run] .m4inb-t24 { animation-delay: 1.20s; }
.m4inb[data-run] .m4inb-t25 { animation-delay: 1.25s; }
.m4inb[data-run] .m4inb-t26 { animation-delay: 1.30s; }
.m4inb[data-run] .m4inb-t27 { animation-delay: 1.35s; }
.m4inb[data-run] .m4inb-t28 { animation-delay: 1.40s; }
.m4inb[data-run] .m4inb-t29 { animation-delay: 1.45s; }
.m4inb[data-run] .m4inb-t30 { animation-delay: 1.50s; }
.m4inb[data-run] .m4inb-t31 { animation-delay: 1.55s; }
.m4inb[data-run] .m4inb-t32 { animation-delay: 1.60s; }
.m4inb[data-run] .m4inb-t33 { animation-delay: 1.65s; }
.m4inb[data-run] .m4inb-t34 { animation-delay: 1.70s; }
.m4inb[data-run] .m4inb-t35 { animation-delay: 1.75s; }
.m4inb[data-run] .m4inb-t36 { animation-delay: 1.80s; }
.m4inb[data-run] .m4inb-t37 { animation-delay: 1.85s; }
.m4inb[data-run] .m4inb-t38 { animation-delay: 1.90s; }
.m4inb[data-run] .m4inb-t39 { animation-delay: 1.95s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4inb").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4inb-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The tray and paper plane are drawn and still next to the text.
Running cost: Eight small strokes repaint for about 1.4 seconds when the pane first shows, then nothing runs.
- Change the line colour with `--m4inb-pen` and the plane and button colour with `--m4inb-accent`.
- Rewrite the heading and sentence in `.m4inb-h` and `.m4inb-p` to say what will appear in this list.
Mountain Range and Hut Trail on a Navy Hero
A trekking guide hero on deep navy. Three ridgelines draw from back to front in cream ink, a sun and a few cloud strokes follow, shading hatches settle on the slopes and an amber trail climbs between them, dropping numbered markers for each night's stop. On narrow screens the drawing crops at the sides instead of shrinking, so the trail stays readable.
<section class="m4mtn">
<div class="m4mtn-head">
<p class="m4mtn-eyebrow">Hut-to-hut route · Glen Ardnish</p>
<h2 class="m4mtn-h">The Corrie Way</h2>
<p class="m4mtn-p">Three days on foot from Ardnish Hut over the Coire saddle to the summit cairn, with a night in the stone bothy on the way.</p>
<a class="m4mtn-btn" href="#">Plan the route</a>
</div>
<svg class="m4mtn-art" viewBox="0 0 1000 360" preserveAspectRatio="xMidYMax slice" role="img" aria-label="Line drawing of the mountain range with the trail climbing from Ardnish Hut, past Coire Bothy, to the summit cairn" focusable="false">
<circle class="m4mtn-s m4mtn-t4 m4mtn-sun" cx="806" cy="118" r="22" pathLength="1" transform="rotate(-90 806 118)"/>
<path class="m4mtn-s m4mtn-t9 m4mtn-cloud" d="M736 130H788M756 140H826M776 121H796" pathLength="1"/>
<path class="m4mtn-s m4mtn-t0 m4mtn-slow m4mtn-far" d="M0 226L40 214L70 200L92 204L130 186L160 194L200 170L240 150L262 160L290 166L320 150L352 136L380 120L404 134L430 148L452 156L480 144L520 134L548 150L580 168L612 160L650 134L690 110L712 124L740 140L770 150L810 138L850 128L880 146L920 162L960 154L1000 146" pathLength="1"/>
<path class="m4mtn-bgfill" d="M0 282L50 262L90 246L120 232L150 240L200 250L240 228L270 210L300 196L326 206L360 214L392 196L430 172L452 160L470 150L494 166L516 180L540 190L572 178L610 172L650 196L700 226L740 214L770 200L800 192L840 206L880 228L910 234L950 222L1000 214L1000 360H0Z"/>
<path class="m4mtn-s m4mtn-t3 m4mtn-slow m4mtn-mid" d="M0 282L50 262L90 246L120 232L150 240L200 250L240 228L270 210L300 196L326 206L360 214L392 196L430 172L452 160L470 150L494 166L516 180L540 190L572 178L610 172L650 196L700 226L740 214L770 200L800 192L840 206L880 228L910 234L950 222L1000 214" pathLength="1"/>
<path class="m4mtn-bgfill" d="M0 332C60 316 140 304 232 296C268 286 300 272 330 262C356 268 390 282 420 286C450 270 486 246 520 236C548 248 572 262 600 270C680 292 760 302 1000 312L1000 360H0Z"/>
<path class="m4mtn-s m4mtn-t6 m4mtn-slow m4mtn-near" d="M0 332C60 316 140 304 232 296C268 286 300 272 330 262C356 268 390 282 420 286C450 270 486 246 520 236C548 248 572 262 600 270C680 292 760 302 1000 312" pathLength="1"/>
<path class="m4mtn-s m4mtn-t12 m4mtn-quick m4mtn-hatch" d="M486 164L478 182M500 172L492 190M514 180L507 196M528 186L522 200" pathLength="1"/>
<path class="m4mtn-s m4mtn-t13 m4mtn-quick m4mtn-hatch" d="M314 202L308 216M328 206L323 220M342 210L338 222" pathLength="1"/>
<path class="m4mtn-s m4mtn-t14 m4mtn-quick m4mtn-hatch" d="M708 120L700 136M722 126L715 142M736 134L730 148" pathLength="1"/>
<path class="m4mtn-s m4mtn-t15 m4mtn-quick m4mtn-hatch" d="M540 244L533 258M556 252L550 264M572 258L567 268" pathLength="1"/>
<path class="m4mtn-s m4mtn-t8 m4mtn-slow m4mtn-trail" d="M190 352C226 334 256 320 290 304C318 291 304 280 334 266C356 256 342 238 362 222C388 206 418 198 432 182C444 170 452 166 466 155" pathLength="1"/>
<g class="m4mtn-f m4mtn-t11"><circle class="m4mtn-mk" cx="334" cy="266" r="11"/><text x="334" y="270.5">1</text></g>
<g class="m4mtn-f m4mtn-t17"><circle class="m4mtn-mk" cx="362" cy="222" r="11"/><text x="362" y="226.5">2</text></g>
<g class="m4mtn-f m4mtn-t23"><circle class="m4mtn-mk" cx="469" cy="151" r="11"/><text x="469" y="155.5">3</text></g>
</svg>
<ol class="m4mtn-legend">
<li><span>1</span>Ardnish Hut <em>Day 1</em></li>
<li><span>2</span>Coire Bothy <em>Day 2</em></li>
<li><span>3</span>Summit cairn <em>Day 3</em></li>
</ol>
<button type="button" class="m4mtn-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the navy, cream and trail colours at the top of .m4mtn, and the trail path if you move the huts. */
.m4mtn { --m4mtn-bg: #13213a; --m4mtn-ink: #f1e9d8; --m4mtn-quiet: #c3c8d2; --m4mtn-line: #34446a; --m4mtn-focus: #e3a95b; --m4mtn-trail: #e3a95b; --m4mtn-replaybg: #13213a; }
.m4mtn { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4mtn *, .m4mtn *::before, .m4mtn *::after { box-sizing: border-box; }
.m4mtn svg { display: block; }
.m4mtn .m4mtn-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4mtn-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4mtn-line); border-radius: 999px; background: var(--m4mtn-replaybg, transparent); color: var(--m4mtn-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4mtn-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4mtn-replay:hover { color: var(--m4mtn-ink); }
.m4mtn-replay:focus-visible { outline: 2px solid var(--m4mtn-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4mtn.is-js:not([data-run]) .m4mtn-s { stroke-dashoffset: 1; }
.m4mtn.is-js:not([data-run]) .m4mtn-f { opacity: 0; }
}
.m4mtn[data-run] .m4mtn-s { animation: m4mtn-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4mtn[data-run] .m4mtn-f { animation: m4mtn-fade .5s ease-out both; }
.m4mtn[data-run] .m4mtn-slow { animation-duration: 1s; }
.m4mtn[data-run] .m4mtn-quick { animation-duration: .35s; }
@keyframes m4mtn-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4mtn-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4mtn[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4mtn *, .m4mtn *::before, .m4mtn *::after { animation: none !important; transition: none !important; }
.m4mtn-replay { display: none; }
}
.m4mtn { background: var(--m4mtn-bg); color: var(--m4mtn-ink); padding: 56px 0 76px; }
.m4mtn-head { max-width: 1000px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }
.m4mtn-eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--m4mtn-trail); }
.m4mtn-h { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(36px, 5.5vw, 60px); line-height: 1.02; letter-spacing: -.015em; }
.m4mtn-p { margin: 16px 0 0; max-width: 34em; font-size: 16.5px; line-height: 1.6; color: var(--m4mtn-quiet); }
.m4mtn-btn { display: inline-flex; align-items: center; min-height: 44px; margin-top: 22px; padding: 0 22px; border-radius: 999px; background: var(--m4mtn-ink); color: var(--m4mtn-bg); font-weight: 650; font-size: 14.5px; text-decoration: none; }
.m4mtn-btn:focus-visible { outline: 2px solid var(--m4mtn-focus); outline-offset: 3px; }
.m4mtn-art { width: 100%; height: clamp(250px, 32vw, 360px); margin-top: -10px; }
.m4mtn-art .m4mtn-s { stroke: var(--m4mtn-ink); }
.m4mtn-art .m4mtn-bgfill { fill: var(--m4mtn-bg); }
.m4mtn-art .m4mtn-far { stroke-width: 1.3; opacity: .4; }
.m4mtn-art .m4mtn-mid { stroke-width: 1.7; opacity: .7; }
.m4mtn-art .m4mtn-near { stroke-width: 2.2; }
.m4mtn-art .m4mtn-hatch { stroke-width: 1.2; opacity: .55; }
.m4mtn-art .m4mtn-sun { stroke: var(--m4mtn-trail); stroke-width: 1.6; }
.m4mtn-art .m4mtn-cloud { stroke-width: 1.4; opacity: .6; }
.m4mtn-art .m4mtn-trail { stroke: var(--m4mtn-trail); stroke-width: 2.4; }
.m4mtn-art .m4mtn-mk { fill: var(--m4mtn-bg); stroke: var(--m4mtn-trail); stroke-width: 2; }
.m4mtn-art text { font-family: inherit; font-size: 13px; font-weight: 700; fill: var(--m4mtn-trail); text-anchor: middle; }
.m4mtn-legend { max-width: 1000px; margin: 8px auto 0; padding: 18px clamp(20px, 5vw, 48px) 0; list-style: none; display: flex; flex-wrap: wrap; gap: 12px 32px; border-top: 1px solid var(--m4mtn-line); font-size: 15px; }
.m4mtn-legend li { display: flex; align-items: center; gap: 10px; }
.m4mtn-legend span { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--m4mtn-trail); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--m4mtn-trail); }
.m4mtn-legend em { font-style: normal; color: var(--m4mtn-quiet); font-size: 13.5px; }
.m4mtn[data-run] .m4mtn-t0 { animation-delay: 0.00s; }
.m4mtn[data-run] .m4mtn-t1 { animation-delay: 0.04s; }
.m4mtn[data-run] .m4mtn-t2 { animation-delay: 0.09s; }
.m4mtn[data-run] .m4mtn-t3 { animation-delay: 0.14s; }
.m4mtn[data-run] .m4mtn-t4 { animation-delay: 0.18s; }
.m4mtn[data-run] .m4mtn-t5 { animation-delay: 0.22s; }
.m4mtn[data-run] .m4mtn-t6 { animation-delay: 0.27s; }
.m4mtn[data-run] .m4mtn-t7 { animation-delay: 0.32s; }
.m4mtn[data-run] .m4mtn-t8 { animation-delay: 0.36s; }
.m4mtn[data-run] .m4mtn-t9 { animation-delay: 0.40s; }
.m4mtn[data-run] .m4mtn-t10 { animation-delay: 0.45s; }
.m4mtn[data-run] .m4mtn-t11 { animation-delay: 0.49s; }
.m4mtn[data-run] .m4mtn-t12 { animation-delay: 0.54s; }
.m4mtn[data-run] .m4mtn-t13 { animation-delay: 0.58s; }
.m4mtn[data-run] .m4mtn-t14 { animation-delay: 0.63s; }
.m4mtn[data-run] .m4mtn-t15 { animation-delay: 0.67s; }
.m4mtn[data-run] .m4mtn-t16 { animation-delay: 0.72s; }
.m4mtn[data-run] .m4mtn-t17 { animation-delay: 0.77s; }
.m4mtn[data-run] .m4mtn-t18 { animation-delay: 0.81s; }
.m4mtn[data-run] .m4mtn-t19 { animation-delay: 0.85s; }
.m4mtn[data-run] .m4mtn-t20 { animation-delay: 0.90s; }
.m4mtn[data-run] .m4mtn-t21 { animation-delay: 0.94s; }
.m4mtn[data-run] .m4mtn-t22 { animation-delay: 0.99s; }
.m4mtn[data-run] .m4mtn-t23 { animation-delay: 1.03s; }
.m4mtn[data-run] .m4mtn-t24 { animation-delay: 1.08s; }
.m4mtn[data-run] .m4mtn-t25 { animation-delay: 1.12s; }
.m4mtn[data-run] .m4mtn-t26 { animation-delay: 1.17s; }
.m4mtn[data-run] .m4mtn-t27 { animation-delay: 1.21s; }
.m4mtn[data-run] .m4mtn-t28 { animation-delay: 1.26s; }
.m4mtn[data-run] .m4mtn-t29 { animation-delay: 1.30s; }
.m4mtn[data-run] .m4mtn-t30 { animation-delay: 1.35s; }
.m4mtn[data-run] .m4mtn-t31 { animation-delay: 1.40s; }
.m4mtn[data-run] .m4mtn-t32 { animation-delay: 1.44s; }
.m4mtn[data-run] .m4mtn-t33 { animation-delay: 1.48s; }
.m4mtn[data-run] .m4mtn-t34 { animation-delay: 1.53s; }
.m4mtn[data-run] .m4mtn-t35 { animation-delay: 1.57s; }
.m4mtn[data-run] .m4mtn-t36 { animation-delay: 1.62s; }
.m4mtn[data-run] .m4mtn-t37 { animation-delay: 1.67s; }
.m4mtn[data-run] .m4mtn-t38 { animation-delay: 1.71s; }
.m4mtn[data-run] .m4mtn-t39 { animation-delay: 1.75s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4mtn").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4mtn-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The whole range, the trail and all three numbered stops are drawn and still.
Running cost: Long ridge strokes repaint while they draw for under 1.6 seconds, then the hero is static.
- Change the trail and marker colour with `--m4mtn-trail` and the night sky with `--m4mtn-bg`.
- Move a hut by editing its marker circle's `cx` and `cy` and the matching point in the trail path.
No Search Results State with Empty Clothes Rail
A no results page for a small clothing shop's search. Under the filled search field, a clothes rail draws itself in terracotta with three empty hangers, and a magnifying glass circles in over it, while the heading names the search and two actions offer a way out. On phones the search field drops below the shop name.
<section class="m4srch">
<div class="m4srch-shop">
<header class="m4srch-top">
<p class="m4srch-brand">Marlow & Weft</p>
<form class="m4srch-form" role="search" action="#">
<label class="m4srch-sr" for="m4srch-q">Search the shop</label>
<input class="m4srch-input" id="m4srch-q" type="search" value="linen apron xs" autocomplete="off"/>
<button class="m4srch-go" type="submit">Search</button>
</form>
</header>
<p class="m4srch-meta">0 results</p>
<div class="m4srch-empty">
<svg class="m4srch-art" viewBox="0 0 260 180" aria-hidden="true" focusable="false">
<path class="m4srch-s m4srch-t0" d="M52 40H208" pathLength="1"/>
<path class="m4srch-s m4srch-t1 m4srch-quick" d="M62 40V152M198 40V152" pathLength="1"/>
<path class="m4srch-s m4srch-t3 m4srch-quick" d="M42 158L62 152L82 158M178 158L198 152L218 158" pathLength="1"/>
<path class="m4srch-s m4srch-t4 m4srch-thin" d="M86 37C86 31 94 31 94 37C94 41 90 42 90 47" pathLength="1"/>
<path class="m4srch-s m4srch-t5" d="M90 47L70.5 61.5C69 62.6 69.6 65 71.5 65H108.5C110.4 65 111 62.6 109.5 61.5Z" pathLength="1"/>
<g transform="rotate(6 132 40)">
<path class="m4srch-s m4srch-t6 m4srch-thin" d="M128 37C128 31 136 31 136 37C136 41 132 42 132 47" pathLength="1"/>
<path class="m4srch-s m4srch-t7" d="M132 47L112.5 61.5C111 62.6 111.6 65 113.5 65H150.5C152.4 65 153 62.6 151.5 61.5Z" pathLength="1"/>
</g>
<path class="m4srch-s m4srch-t8 m4srch-thin" d="M170 37C170 31 178 31 178 37C178 41 174 42 174 47" pathLength="1"/>
<path class="m4srch-s m4srch-t9" d="M174 47L154.5 61.5C153 62.6 153.6 65 155.5 65H192.5C194.4 65 195 62.6 193.5 61.5Z" pathLength="1"/>
<circle class="m4srch-s m4srch-t11 m4srch-slow m4srch-lens" cx="150" cy="118" r="21" pathLength="1" transform="rotate(-140 150 118)"/>
<path class="m4srch-s m4srch-t15 m4srch-handle" d="M165.5 133.5L181 149" pathLength="1"/>
<path class="m4srch-s m4srch-t17 m4srch-quick m4srch-thin" d="M140 110A13 13 0 0 1 151 104" pathLength="1"/>
</svg>
<h2 class="m4srch-h">No matches for “linen apron xs”</h2>
<p class="m4srch-p">Try fewer words or check the spelling. Our aprons are cut in three sizes, so searching for the fabric alone usually finds them.</p>
<div class="m4srch-actions">
<a class="m4srch-btn" href="#">Clear the search</a>
<a class="m4srch-ghost" href="#">Browse every apron</a>
</div>
</div>
</div>
<button type="button" class="m4srch-replay" aria-label="Replay the drawing"><svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M4.5 11a5.5 5.5 0 1 0 1.8-4.6"/><path d="M5 3.2v3.6h3.6"/></svg>Replay</button>
</section>
<style>
/* Edit these first: the terracotta line and cream colours at the top of .m4srch, and the search words in the field and heading. */
.m4srch { --m4srch-bg: #f6efe6; --m4srch-panel: #fffaf3; --m4srch-ink: #2b211c; --m4srch-quiet: #66574c; --m4srch-line: #e6d9c8; --m4srch-focus: #a5482a; --m4srch-pen: #a5482a; }
.m4srch { position: relative; box-sizing: border-box; overflow: hidden; font-family: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.m4srch *, .m4srch *::before, .m4srch *::after { box-sizing: border-box; }
.m4srch svg { display: block; }
.m4srch .m4srch-s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.m4srch-replay { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--m4srch-line); border-radius: 999px; background: var(--m4srch-replaybg, transparent); color: var(--m4srch-quiet); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.m4srch-replay svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m4srch-replay:hover { color: var(--m4srch-ink); }
.m4srch-replay:focus-visible { outline: 2px solid var(--m4srch-focus); outline-offset: 2px; }
/* Hidden until the drawing starts, only when motion is allowed and the script is running. */
@media (prefers-reduced-motion: no-preference) {
.m4srch.is-js:not([data-run]) .m4srch-s { stroke-dashoffset: 1; }
.m4srch.is-js:not([data-run]) .m4srch-f { opacity: 0; }
}
.m4srch[data-run] .m4srch-s { animation: m4srch-draw .6s cubic-bezier(.5, .05, .3, 1) both; }
.m4srch[data-run] .m4srch-f { animation: m4srch-fade .5s ease-out both; }
.m4srch[data-run] .m4srch-slow { animation-duration: 1s; }
.m4srch[data-run] .m4srch-quick { animation-duration: .35s; }
@keyframes m4srch-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes m4srch-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Paused while scrolled out of view. */
.m4srch[data-off] * { animation-play-state: paused !important; }
/* Reduced motion: the finished drawing, no movement. */
@media (prefers-reduced-motion: reduce) {
.m4srch *, .m4srch *::before, .m4srch *::after { animation: none !important; transition: none !important; }
.m4srch-replay { display: none; }
}
.m4srch { background: var(--m4srch-bg); color: var(--m4srch-ink); padding: 40px clamp(14px, 4vw, 48px) 76px; }
.m4srch-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.m4srch-shop { max-width: 880px; margin: 0 auto; background: var(--m4srch-panel); border: 1px solid var(--m4srch-line); border-radius: 14px; box-shadow: 0 22px 44px -34px rgba(43, 33, 28, .45); }
.m4srch-top { display: flex; align-items: center; gap: 20px; padding: 16px 22px; border-bottom: 1px solid var(--m4srch-line); }
.m4srch-brand { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 20px; white-space: nowrap; }
.m4srch-form { flex: 1; display: flex; gap: 8px; min-width: 0; }
.m4srch-input { flex: 1; min-width: 0; min-height: 42px; padding: 0 14px; border: 1px solid #d6c6b2; border-radius: 10px; background: #fff; color: var(--m4srch-ink); font: inherit; font-size: 15px; }
.m4srch-input:focus-visible, .m4srch-go:focus-visible, .m4srch a:focus-visible { outline: 2px solid var(--m4srch-focus); outline-offset: 2px; }
.m4srch-go { min-height: 42px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--m4srch-ink); color: #fffaf3; font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.m4srch-meta { margin: 0; padding: 14px 22px 0; font-size: 13.5px; color: var(--m4srch-quiet); }
.m4srch-empty { padding: 20px 24px 48px; text-align: center; }
.m4srch-art { width: 240px; max-width: 72%; height: auto; margin: 0 auto 10px; }
.m4srch-art .m4srch-s { stroke: var(--m4srch-pen); stroke-width: 2; }
.m4srch-art .m4srch-thin { stroke-width: 1.4; }
.m4srch-art .m4srch-lens { stroke: var(--m4srch-ink); stroke-width: 2.2; }
.m4srch-art .m4srch-handle { stroke: var(--m4srch-ink); stroke-width: 4.5; }
.m4srch-h { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(22px, 3vw, 28px); line-height: 1.2; }
.m4srch-p { margin: 10px auto 0; max-width: 28em; font-size: 15px; line-height: 1.6; color: var(--m4srch-quiet); }
.m4srch-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.m4srch-btn, .m4srch-ghost { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; font-size: 14.5px; font-weight: 600; text-decoration: none; }
.m4srch-btn { background: var(--m4srch-pen); color: #fffaf3; }
.m4srch-btn:hover { background: #8c3c22; }
.m4srch-ghost { color: var(--m4srch-ink); border: 1px solid #d6c6b2; }
@media (max-width: 600px) {
.m4srch-top { flex-direction: column; align-items: stretch; gap: 12px; }
}
.m4srch[data-run] .m4srch-t0 { animation-delay: 0.00s; }
.m4srch[data-run] .m4srch-t1 { animation-delay: 0.05s; }
.m4srch[data-run] .m4srch-t2 { animation-delay: 0.10s; }
.m4srch[data-run] .m4srch-t3 { animation-delay: 0.15s; }
.m4srch[data-run] .m4srch-t4 { animation-delay: 0.20s; }
.m4srch[data-run] .m4srch-t5 { animation-delay: 0.25s; }
.m4srch[data-run] .m4srch-t6 { animation-delay: 0.30s; }
.m4srch[data-run] .m4srch-t7 { animation-delay: 0.35s; }
.m4srch[data-run] .m4srch-t8 { animation-delay: 0.40s; }
.m4srch[data-run] .m4srch-t9 { animation-delay: 0.45s; }
.m4srch[data-run] .m4srch-t10 { animation-delay: 0.50s; }
.m4srch[data-run] .m4srch-t11 { animation-delay: 0.55s; }
.m4srch[data-run] .m4srch-t12 { animation-delay: 0.60s; }
.m4srch[data-run] .m4srch-t13 { animation-delay: 0.65s; }
.m4srch[data-run] .m4srch-t14 { animation-delay: 0.70s; }
.m4srch[data-run] .m4srch-t15 { animation-delay: 0.75s; }
.m4srch[data-run] .m4srch-t16 { animation-delay: 0.80s; }
.m4srch[data-run] .m4srch-t17 { animation-delay: 0.85s; }
.m4srch[data-run] .m4srch-t18 { animation-delay: 0.90s; }
.m4srch[data-run] .m4srch-t19 { animation-delay: 0.95s; }
.m4srch[data-run] .m4srch-t20 { animation-delay: 1.00s; }
.m4srch[data-run] .m4srch-t21 { animation-delay: 1.05s; }
.m4srch[data-run] .m4srch-t22 { animation-delay: 1.10s; }
.m4srch[data-run] .m4srch-t23 { animation-delay: 1.15s; }
.m4srch[data-run] .m4srch-t24 { animation-delay: 1.20s; }
.m4srch[data-run] .m4srch-t25 { animation-delay: 1.25s; }
.m4srch[data-run] .m4srch-t26 { animation-delay: 1.30s; }
.m4srch[data-run] .m4srch-t27 { animation-delay: 1.35s; }
.m4srch[data-run] .m4srch-t28 { animation-delay: 1.40s; }
.m4srch[data-run] .m4srch-t29 { animation-delay: 1.45s; }
.m4srch[data-run] .m4srch-t30 { animation-delay: 1.50s; }
.m4srch[data-run] .m4srch-t31 { animation-delay: 1.55s; }
.m4srch[data-run] .m4srch-t32 { animation-delay: 1.60s; }
.m4srch[data-run] .m4srch-t33 { animation-delay: 1.65s; }
.m4srch[data-run] .m4srch-t34 { animation-delay: 1.70s; }
.m4srch[data-run] .m4srch-t35 { animation-delay: 1.75s; }
.m4srch[data-run] .m4srch-t36 { animation-delay: 1.80s; }
.m4srch[data-run] .m4srch-t37 { animation-delay: 1.85s; }
.m4srch[data-run] .m4srch-t38 { animation-delay: 1.90s; }
.m4srch[data-run] .m4srch-t39 { animation-delay: 1.95s; }
</style>
<script>
(function () {
// Draws once when the piece enters the view (works inside a scrolling box too) and pauses any loop when it leaves.
document.querySelectorAll(".m4srch").forEach(function (root) {
root.classList.add("is-js");
function play() {
root.removeAttribute("data-run");
void root.offsetWidth; // restart the keyframes
root.setAttribute("data-run", "");
}
var btn = root.querySelector(".m4srch-replay"), seen = false;
if (btn) btn.addEventListener("click", play);
// Demo only: keep the search on this page. Remove this line to submit to your own search page.
root.querySelector(".m4srch-form").addEventListener("submit", function (e) { e.preventDefault(); });
if (!("IntersectionObserver" in window)) return play();
new IntersectionObserver(function (es) {
var on = es[0].isIntersecting;
root.toggleAttribute("data-off", !on);
if (on && !seen) { seen = true; play(); }
}, { threshold: 0.2 }).observe(root);
});
})();
</script>
With reduced motion: The rail, hangers and magnifier are drawn and still above the message.
Running cost: Twelve short strokes repaint for about 1.5 seconds, then the page is static.
- Recolour the rail and hangers with `--m4srch-pen`; the magnifier uses the ink colour.
- Change the words in the input's `value` and in the heading together so they always match the real query.
Performance notes
Changing stroke-dashoffset makes the browser repaint that path, so the cost grows with the size and number of strokes drawing at the same moment. Staggering helps twice: it looks more natural and keeps only a few paths changing at once. Once drawn, nothing moves and nothing costs.
pathLength="1" removes the need to measure each path with script. The only code in these pieces is an observer that adds a class when the drawing comes into view and pauses any idle loop when it leaves.
Questions
How do I make an SVG draw itself?
Give the path pathLength="1", then in CSS set stroke-dasharray: 1 and stroke-dashoffset: 1 so the single dash is shifted out of sight. Animate stroke-dashoffset to 0 and the stroke appears from its start point to its end. Reverse the path direction in your editor if it draws the wrong way.
Why does my SVG line animation not work?
The usual causes are a shape that is filled rather than stroked, an SVG added through an img tag so page CSS cannot reach it, or a missing pathLength so the dash is shorter than the path. Check each in that order.
Is CSS or SMIL better for SVG animation?
CSS keeps the animation in your stylesheet, responds to classes and media queries such as prefers-reduced-motion, and is what these pieces use. SMIL elements like animate also work in current browsers, but they are harder to pause, theme and keep in sync with the page.
Can this replace a Lottie animation?
For drawing, fading and moving parts it can, with no JSON file and no player script. Keep a dedicated animation format for complex frame-by-frame work exported from a motion design tool.
Also in the gallery: Handwritten Word Drawn by Pen Stroke, Hand-Drawn Underline Under One Word.
More collections: Animated Icons in SVG: Interface, Weather and Success States, Logo Animations and Logo Reveals in SVG and CSS, 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