Paced breath — 4-7-8
Variant: 4-7-8
The same guide on the 4-7-8 pattern: in for four, hold for seven at the top, out for eight. The curve is unchanged from the box; what calms is the ratio — the exhale covers exactly the distance of the inhale in twice the time, so the disc deflates visibly slower than it filled, and the eye reads that slowing before the count confirms it. Seven seconds of a disc that does not move is the longest stillness in the family, and it is the part people skip, so the rail gives it the width it deserves rather than equal thirds. Count, disc and rail are three readings of one clock, which is why none of them can disagree. Use it where the moment is winding down — end of a session, before sleep — rather than for focus.
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 — 4-7-8</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 — nineteen seconds: in for four, hold for seven, out for
eight. Each cell of the count is a second at the default pace. */
--cycle: 19s;
--t: calc(var(--cycle) / var(--speed));
/* Sine in-out for both breaths. The curve is the same as the box; what
calms is the ratio — the exhale covers the same distance as the
inhale in twice the time, so the disc visibly deflates at half the
speed it filled. */
--_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 hold sits at the top and nowhere else: seven seconds of a
disc that does not move is the longest stillness in the family, and
it is the part people skip, so it gets the widest segment but one. */
@keyframes lungs {
0% {
transform: scale(var(--_empty));
animation-timing-function: var(--_ease-breath);
}
21.053%,
57.895% {
transform: scale(1);
animation-timing-function: var(--_ease-breath);
}
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(19, end) infinite;
}
.count b {
display: block;
height: 1em;
font-weight: inherit;
text-align: center;
}
@keyframes tick {
from {
transform: translateY(0);
}
to {
transform: translateY(-19em);
}
}
.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. */
.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.263%,
20.421% {
opacity: 1;
}
21.053%,
100% {
opacity: 0;
}
}
@keyframes say-hold {
0%,
21.053% {
opacity: 0;
}
22.316%,
57.263% {
opacity: 1;
}
57.895%,
100% {
opacity: 0;
}
}
@keyframes say-out {
0%,
57.895% {
opacity: 0;
}
59.158%,
99.368% {
opacity: 1;
}
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: 4 1 0;
}
.ticks i:nth-child(2),
.labels span:nth-child(2) {
flex-grow: 7;
}
.ticks i:nth-child(3),
.labels span:nth-child(3) {
flex-grow: 8;
}
.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);
}
21.053%,
57.895% {
opacity: 1;
animation-timing-function: var(--_ease-breath);
}
100% {
opacity: 0.32;
}
}
}
</style>
</head>
<body>
<div
class="card"
role="img"
aria-label="4-7-8 breathing guide: breathe in for four seconds, hold for seven, breathe out for eight"
>
<div class="head" aria-hidden="true">
<b>4-7-8 breathing</b>
<span>4 · 7 · 8</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>5</b><b>6</b><b>7</b
><b>1</b><b>2</b><b>3</b><b>4</b><b>5</b><b>6</b><b>7</b><b>8</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></div>
</div>
<div class="labels"><span>In 4</span><span>Hold 7</span><span>Out 8</span></div>
</div>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.