Paced breath — box, 4-4-4-4
Variant: Box 4-4-4-4
A breathing guide for the long waits: in for four, hold for four, out for four, hold for four, with the count in real seconds. The holds are the reason to study it — two keyframes with the same value, so the disc is exactly still for four seconds, because a hold that drifts even a pixel tells the body to keep breathing. Inhale and exhale run on a sine in-out rather than the library’s strong ease-in-out, which would crowd the volume into the middle second and read as a gulp. Nothing assumes the reader has done this before: a dashed ring marks “full” before the first breath, one instruction word at a time names the phase, the count steps on the same clock as the disc, and the whole pattern sits underneath as a rail sized by seconds. Reach for it in focus timers, pre-call screens and long installs where an idle state can offer something better than a spinner.
The source
A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- The count is in seconds: a remix may slow the pace, never hurry it. -->
<meta name="animation-knobs" content="speed: 0.7-1" />
<title>Paced breath — box, 4-4-4-4</title>
<style>
:root {
/* Neutrals — fixed, never remixed. */
--ivory: #faf9f5;
--paper: #ffffff;
--oat: #e3dacc;
--slate: #141413;
/* Knobs — the remix API. A knob exists iff declared here and used below. */
--hue: 38.8;
--lift: 0;
--chroma: 1;
--round: 1;
--speed: 1;
/* Accents — derived from the knobs with the family's offsets baked in,
so one hue roll moves them together. Defaults reproduce the original hex. */
--clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
--clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
--olive: oklch(
calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
);
--rust: oklch(
calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
);
/* Clock — four sides of four seconds. The count in the disc is a real
second at the default pace, so the cycle is the pattern, not a
stylisation of it. 1% of the loop is 160ms. */
--cycle: 16s;
--t: calc(var(--cycle) / var(--speed));
/* Sine in-out. Volume under a steady effort rises like a sine, and its
ends are soft enough to arrive at a hold without a visible brake. The
library's stronger ease-in-out would crowd the motion into the middle
second and read as a gulp. */
--_ease-breath: cubic-bezier(0.37, 0, 0.63, 1);
--_disc: clamp(84px, 30vmin, 128px);
--_empty: 0.62;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
background: var(--ivory);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
color: var(--slate);
}
.card {
display: grid;
justify-items: center;
gap: clamp(8px, 2.6vmin, 14px);
width: min(340px, calc(100% - 26px));
padding: clamp(12px, 3.6vmin, 20px) clamp(14px, 4.4vw, 22px);
border: 1px solid var(--oat);
border-radius: calc(16px * var(--round));
background: var(--paper);
}
.head {
display: flex;
justify-content: space-between;
align-items: baseline;
width: 100%;
font-size: clamp(11.5px, 3.3vw, 13px);
color: color-mix(in srgb, var(--slate) 62%, transparent);
}
.head b {
font-weight: 600;
color: var(--slate);
}
.head span {
font-variant-numeric: tabular-nums;
}
/* The ring is where the breath is going. It never moves, so a first-time
reader sees the target before they have done anything — the guide does
not depend on remembering what "full" looked like last cycle. */
.lungs {
position: relative;
display: grid;
place-items: center;
width: var(--_disc);
height: var(--_disc);
}
.full,
.air {
position: absolute;
inset: 0;
border-radius: 50%;
}
/* Set 3px outside the disc's full size, so at the top of a breath
the two edges sit side by side instead of fusing into one fuzzy line. */
.full {
inset: -3px;
border: 1.5px dashed color-mix(in srgb, var(--slate) 22%, transparent);
}
.air {
border: 1.5px solid var(--clay);
background: color-mix(in srgb, var(--clay) 16%, var(--paper));
transform: scale(var(--_empty));
animation: lungs var(--t) linear infinite;
}
/* The holds are flat: two keyframes with the same value, so the disc is
exactly still for four seconds. A hold that drifts even a pixel tells
the body to keep breathing, which is the one thing a hold is not. */
@keyframes lungs {
0% {
transform: scale(var(--_empty));
animation-timing-function: var(--_ease-breath);
}
25%,
50% {
transform: scale(1);
animation-timing-function: var(--_ease-breath);
}
75%,
100% {
transform: scale(var(--_empty));
}
}
/* One strip holds the whole cycle's count, one cell per second, and
steps through it on the same clock as the disc — so the numeral cannot
drift from the breath. Digits cut, never roll: a count is read on the
frame it lands. */
.count {
position: relative;
height: 1em;
overflow: hidden;
font-size: clamp(22px, 7vmin, 30px);
font-weight: 600;
line-height: 1;
font-variant-numeric: tabular-nums;
color: var(--clay-d);
}
.count > span {
display: block;
animation: tick var(--t) steps(16, end) infinite;
}
.count b {
display: block;
height: 1em;
font-weight: inherit;
text-align: center;
}
@keyframes tick {
from {
transform: translateY(0);
}
to {
transform: translateY(-16em);
}
}
.say {
position: relative;
width: 100%;
height: 1.3em;
font-size: clamp(15px, 4.6vw, 18px);
font-weight: 600;
letter-spacing: -0.01em;
text-align: center;
}
.say > span {
position: absolute;
inset: 0;
opacity: 0;
}
/* Each instruction fades in over 240ms and out over 120ms ending on its
boundary — exit faster than entry, and never two words on screen at
once, because overlapping instructions are a contradiction. */
.say .in {
animation: say-in var(--t) linear infinite;
}
.say .hold {
animation: say-hold var(--t) linear infinite;
}
.say .out {
animation: say-out var(--t) linear infinite;
}
@keyframes say-in {
0% {
opacity: 0;
}
1.5%,
24.25% {
opacity: 1;
}
25%,
100% {
opacity: 0;
}
}
@keyframes say-hold {
0%,
25% {
opacity: 0;
}
26.5%,
49.25% {
opacity: 1;
}
50%,
75% {
opacity: 0;
}
76.5%,
99.25% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes say-out {
0%,
50% {
opacity: 0;
}
51.5%,
74.25% {
opacity: 1;
}
75%,
100% {
opacity: 0;
}
}
/* The whole pattern, always on screen. The segments are sized by their
seconds and the fill runs linear because it is a clock; between them a
reader who has never seen box breathing can tell where they are and
what comes next without being told twice. */
.rail {
display: grid;
gap: 6px;
width: 100%;
}
.track {
position: relative;
height: 4px;
overflow: hidden;
border-radius: 999px;
background: var(--oat);
}
.fill {
position: absolute;
inset: 0;
background: var(--clay);
transform: scaleX(0);
transform-origin: left;
animation: run var(--t) linear infinite;
}
@keyframes run {
to {
transform: scaleX(1);
}
}
.ticks,
.labels {
display: flex;
}
.ticks {
position: absolute;
inset: 0;
}
.ticks i + i {
border-left: 2px solid var(--paper);
}
.ticks i,
.labels span {
flex: 1 1 0;
}
.labels {
font-size: clamp(11px, 3.1vw, 12px);
font-variant-numeric: tabular-nums;
color: color-mix(in srgb, var(--slate) 55%, transparent);
}
.labels span + span {
padding-left: 4px;
}
@media (prefers-reduced-motion: reduce) {
/* The disc stops growing and its fill carries the breath as density
instead: pale when empty, solid when full, on the same keyframes.
The cycle is not slowed — the count is in seconds and the pace is the
content — and no fade here runs faster than over four seconds. */
.air {
transform: none;
animation-name: lungs-dim;
}
@keyframes lungs-dim {
0% {
opacity: 0.32;
animation-timing-function: var(--_ease-breath);
}
25%,
50% {
opacity: 1;
animation-timing-function: var(--_ease-breath);
}
75%,
100% {
opacity: 0.32;
}
}
}
</style>
</head>
<body>
<div
class="card"
role="img"
aria-label="Box breathing guide: breathe in for four seconds, hold for four, breathe out for four, hold for four"
>
<div class="head" aria-hidden="true">
<b>Box breathing</b>
<span>4 · 4 · 4 · 4</span>
</div>
<div class="lungs" aria-hidden="true">
<i class="full"></i>
<i class="air"></i>
<div class="count">
<span
><b>1</b><b>2</b><b>3</b><b>4</b><b>1</b><b>2</b><b>3</b><b>4</b><b>1</b><b>2</b><b>3</b
><b>4</b><b>1</b><b>2</b><b>3</b><b>4</b></span
>
</div>
</div>
<div class="say" aria-hidden="true">
<span class="in">Breathe in</span>
<span class="hold">Hold</span>
<span class="out">Breathe out</span>
</div>
<div class="rail" aria-hidden="true">
<div class="track">
<i class="fill"></i>
<div class="ticks"><i></i><i></i><i></i><i></i></div>
</div>
<div class="labels">
<span>In 4</span><span>Hold 4</span><span>Out 4</span><span>Hold 4</span>
</div>
</div>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.