Overflow — edge fades
Variant: Edge fades
A row of filter chips wider than its container, with a fade on each edge that answers exactly one question: is there more this way? At rest only the right edge fades. The first fling starts and the left fade arrives within 90ms — quicker than the 480ms ease-out decay, because content has already left the start. The right fade waits until the last chip lands before leaving, and returns the moment the row heads home on an ease-in-out, a programmatic move between two resting stops. A fade that only ever reports state is the whole design: never decoration, never both edges by default. Every stop is a `translate` percentage against the track itself, so the far end is exactly flush at any width. Use it on chip filters, tab strips and carousels that scroll sideways without a scrollbar.
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" />
<title>Overflow — edge fades</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)
);
--_muted: color-mix(in srgb, var(--slate) 52%, transparent);
/* The scroll window's width, restated wherever an offset depends on it. */
--_w: min(268px, calc(100vw - 64px));
/* Clock — 6s: 1% is 60ms. Two flings forward (14%, 44%), each 480ms
of decay; one 480ms scroll home at 74%. */
--cycle: 6s;
--t: calc(var(--cycle) / var(--speed));
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}
* {
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 {
padding: 14px 16px 16px;
display: grid;
gap: 10px;
border-radius: calc(12px * var(--round));
background: var(--paper);
border: 1px solid var(--oat);
}
.k {
font-size: 11px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--_muted);
}
.win {
position: relative;
width: var(--_w);
overflow: hidden;
}
.track {
display: flex;
gap: 6px;
width: max-content;
animation: track var(--t) linear infinite;
}
/* Percentages in translate resolve against the track, so the far stop
is exactly "window minus content" at any width. A fling decays, so
ease-out; going home is a programmatic move between two on-screen
stops, so ease-in-out. */
@keyframes track {
0%,
14% {
transform: translateX(0);
animation-timing-function: var(--ease-out);
}
22%,
44% {
transform: translateX(calc((var(--_w) - 100%) / 2));
animation-timing-function: var(--ease-out);
}
52%,
74% {
transform: translateX(calc(var(--_w) - 100%));
animation-timing-function: var(--ease-in-out);
}
82%,
100% {
transform: translateX(0);
}
}
.chip {
flex: none;
height: 28px;
display: flex;
align-items: center;
gap: 6px;
padding: 0 11px;
border-radius: 999px;
border: 1px solid var(--oat);
font-size: 12.5px;
white-space: nowrap;
}
.chip b {
font-weight: 500;
color: var(--_muted);
font-variant-numeric: tabular-nums;
}
.chip.on {
background: var(--slate);
border-color: var(--slate);
color: var(--ivory);
}
.chip.on b {
color: color-mix(in srgb, var(--ivory) 65%, transparent);
}
.fade {
position: absolute;
top: 0;
bottom: 0;
width: 40px;
pointer-events: none;
}
.fade-l {
left: 0;
background: linear-gradient(90deg, var(--paper) 15%, transparent);
opacity: 0;
animation: fade-l var(--t) linear infinite;
}
.fade-r {
right: 0;
background: linear-gradient(270deg, var(--paper) 15%, transparent);
animation: fade-r var(--t) linear infinite;
}
/* Each fade answers one question — is there more this way? So the left
one arrives the moment content leaves the start (90ms, quicker than
the fling), and the right one leaves only as the last chip lands. */
@keyframes fade-l {
0%,
14% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
15.5%,
79% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
82%,
100% {
opacity: 0;
}
}
@keyframes fade-r {
0%,
48.5% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
52%,
74% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
75.5%,
100% {
opacity: 1;
}
}
@media (prefers-reduced-motion: reduce) {
.card *,
.card *::before,
.card *::after {
animation-duration: calc(var(--t) * 1.6);
}
/* No sliding: the row dims, jumps a page, and comes back. The fades
still answer "more this way?", which is the half that carries meaning. */
.track {
animation-name: rm-track;
}
.fade-l {
animation-name: rm-fade-l;
}
.fade-r {
animation-name: rm-fade-r;
}
/* Retimed to the jumps, so a fade never claims more than is there. */
@keyframes rm-fade-l {
0%,
15% {
opacity: 0;
}
17%,
79% {
opacity: 1;
}
81%,
100% {
opacity: 0;
}
}
@keyframes rm-fade-r {
0%,
45% {
opacity: 1;
}
47%,
79% {
opacity: 0;
}
81%,
100% {
opacity: 1;
}
}
@keyframes rm-track {
0%,
13% {
opacity: 1;
transform: translateX(0);
}
15% {
opacity: 0.2;
transform: translateX(0);
}
15.01% {
opacity: 0.2;
transform: translateX(calc((var(--_w) - 100%) / 2));
}
19%,
43% {
opacity: 1;
transform: translateX(calc((var(--_w) - 100%) / 2));
}
45% {
opacity: 0.2;
transform: translateX(calc((var(--_w) - 100%) / 2));
}
45.01% {
opacity: 0.2;
transform: translateX(calc(var(--_w) - 100%));
}
49%,
77% {
opacity: 1;
transform: translateX(calc(var(--_w) - 100%));
}
79% {
opacity: 0.2;
transform: translateX(calc(var(--_w) - 100%));
}
79.01% {
opacity: 0.2;
transform: translateX(0);
}
83%,
100% {
opacity: 1;
transform: translateX(0);
}
}
}
</style>
</head>
<body>
<div
class="card"
role="img"
aria-label="A row of filter chips wider than its container; a fade on the right shows there is more, the row is flicked left twice, a fade appears on the left as soon as content passes it, and the right fade disappears when the last chip arrives"
>
<span class="k">Pull requests</span>
<div class="win">
<div class="track">
<span class="chip on">All <b>48</b></span>
<span class="chip">Open <b>12</b></span>
<span class="chip">Assigned to me <b>3</b></span>
<span class="chip">Needs review <b>5</b></span>
<span class="chip">Draft <b>4</b></span>
<span class="chip">Merged <b>29</b></span>
<span class="chip">Stale <b>2</b></span>
</div>
<span class="fade fade-l"></span>
<span class="fade fade-r"></span>
</div>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.