Caret — glide, then blink again
Variant: Glide
A text caret moving between four stops, by click, ↓, End and click again. Every move is the same 96ms glide on ease-out, whatever the distance, because each one is a single keystroke and should feel like one. None overshoots: a caret that passes its target has, for a frame, claimed a position the text does not have, so it settles into each stop the way a lift car levels at a floor. The blink is the other half. The caret holds solid while it moves and for 500ms after landing, then blinks 500ms on and 500ms off, and every move restarts that rhythm. The moves are spaced unevenly so that two of them arrive while the caret is off and visibly snap it back on: the eye goes looking for the caret right after a move, and a blink that kept its old phase would sometimes hide it at exactly that moment. Under reduced motion the caret jumps between stops and keeps the restarting blink. Reach for it for code editors, rich-text fields and any surface that draws its own caret.
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>Caret — glide, then blink again</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 — 4.8s, four moves at 8 / 28 / 58 / 80%, spaced unevenly on
purpose: the moves at 28% and 80% land mid-"off", so the restart is
seen rather than claimed. Each glide is 2% of the loop: 96ms. The
blink is 500ms on, 500ms off, and its phase restarts on every move. */
--cycle: 4.8s;
--t: calc(var(--cycle) / var(--speed));
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--_read: color-mix(in srgb, var(--slate) 80%, transparent);
--_quiet: color-mix(in srgb, var(--slate) 52%, transparent);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
padding: clamp(12px, 3vw, 28px);
background: var(--ivory);
color: var(--slate);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
}
.card {
width: min(360px, 92vw);
padding: clamp(15px, 3.6vw, 24px) clamp(16px, 3.8vw, 26px);
border: 1px solid var(--oat);
border-radius: calc(14px * var(--round));
background: var(--paper);
}
.eyebrow {
font-size: clamp(11px, 2.4vw, 12.5px);
font-weight: 600;
letter-spacing: 0.09em;
text-transform: uppercase;
color: var(--_quiet);
}
/* Monospace is load-bearing: every caret stop is a whole number of ch
and every row a whole number of line-heights, so one translate
addresses any position in the block at any stage size. */
.code {
position: relative;
margin-top: clamp(10px, 2vw, 15px);
white-space: pre;
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
font-size: clamp(14px, 4.4vw, 19px);
line-height: 1.7;
color: var(--_read);
}
.code .k {
color: var(--clay-d);
}
/* The glide is the move; the blink is the rest. Two animations on one
element, authored against the same four event times so they cannot
disagree about when the caret arrived. */
.caret {
position: absolute;
top: 0.22em;
left: 0;
width: max(2px, 0.09em);
height: 1.26em;
margin-left: -1px;
border-radius: 999px;
background: var(--clay);
animation:
glide var(--t) infinite,
blink var(--t) infinite;
}
.via {
display: flex;
align-items: center;
gap: 8px;
margin-top: clamp(12px, 2.6vw, 18px);
font-size: clamp(11px, 2.5vw, 12.5px);
color: var(--_quiet);
}
/* The cause of each move, so the reader can tell a click from a key.
One reel, stepped to the current input; its fade restarts with each
move so a repeated label still reads as a new event. */
.slot {
position: relative;
height: 2.6em;
width: 6.2em;
overflow: hidden;
}
.reel {
display: flex;
flex-direction: column;
animation:
reel var(--t) infinite,
cue var(--t) infinite;
}
.key {
display: inline-flex;
align-items: center;
height: 2.6em;
}
.key b {
padding: 0.12em 0.6em;
border: 1px solid var(--oat);
border-bottom-width: 2px;
border-radius: calc(5px * var(--round));
background: var(--ivory);
font-weight: 500;
color: var(--slate);
}
/* Every move eases out and none overshoots. A caret that passes its
target and comes back has, for a frame, claimed a position the text
does not have — it levels into the stop like a car into a landing. */
@keyframes glide {
0%,
8% {
transform: translate(18ch, 0);
animation-timing-function: var(--ease-out);
}
10%,
28% {
transform: translate(6ch, 0);
animation-timing-function: var(--ease-out);
}
30%,
58% {
transform: translate(6ch, 1.7em);
animation-timing-function: var(--ease-out);
}
60%,
80% {
transform: translate(16ch, 1.7em);
animation-timing-function: var(--ease-out);
}
82%,
100% {
transform: translate(18ch, 0);
}
}
/* Solid while moving and for 500ms after landing, then the ordinary
rhythm. Restarting the phase on every move is what guarantees the
caret is visible at the one moment the eye goes looking for it. */
@keyframes blink {
0%,
2.83% {
opacity: 0;
}
2.84%,
20.42% {
opacity: 1;
}
20.43%,
27.99% {
opacity: 0;
}
28%,
40.42% {
opacity: 1;
}
40.43%,
50.84% {
opacity: 0;
}
50.85%,
70.42% {
opacity: 1;
}
70.43%,
79.99% {
opacity: 0;
}
80%,
92.42% {
opacity: 1;
}
92.43%,
100% {
opacity: 0;
}
}
@keyframes reel {
0%,
7.99% {
transform: translateY(-5.2em);
}
8%,
27.99% {
transform: translateY(0);
}
28%,
57.99% {
transform: translateY(-2.6em);
}
58%,
79.99% {
transform: translateY(-7.8em);
}
80%,
100% {
transform: translateY(-5.2em);
}
}
@keyframes cue {
0%,
6% {
opacity: 0.45;
}
7.99% {
opacity: 0;
}
8% {
opacity: 0.2;
animation-timing-function: var(--ease-out);
}
11%,
26% {
opacity: 1;
}
27.99% {
opacity: 0;
}
28% {
opacity: 0.2;
animation-timing-function: var(--ease-out);
}
31%,
56% {
opacity: 1;
}
57.99% {
opacity: 0;
}
58% {
opacity: 0.2;
animation-timing-function: var(--ease-out);
}
61%,
78% {
opacity: 1;
}
79.99% {
opacity: 0;
}
80% {
opacity: 0.2;
animation-timing-function: var(--ease-out);
}
83%,
94% {
opacity: 1;
}
100% {
opacity: 0.45;
}
}
@media (prefers-reduced-motion: reduce) {
/* The glide is travel, so it goes: the caret steps to each stop on
the event frame. What carries meaning stays — the blink still
restarts on every move, on a clock 1.6x slower. */
.caret,
.reel {
animation-duration: calc(var(--t) * 1.6);
}
.caret {
animation-name: glide-rm, blink;
}
@keyframes glide-rm {
0%,
7.99% {
transform: translate(18ch, 0);
}
8%,
27.99% {
transform: translate(6ch, 0);
}
28%,
57.99% {
transform: translate(6ch, 1.7em);
}
58%,
79.99% {
transform: translate(16ch, 1.7em);
}
80%,
100% {
transform: translate(18ch, 0);
}
}
</style>
</head>
<body>
<div class="card">
<p class="eyebrow">config.ts</p>
<div
class="code"
role="img"
aria-label="A text caret moves between four positions in two lines of code, gliding briefly to each and blinking again only once it has settled."
><div><span class="k">const</span> limit = 120;</div><div>retry(limit, 3);</div><span class="caret"></span></div>
<div class="via" aria-hidden="true">
<span>via</span>
<span class="slot"
><span class="reel"
><span class="key"><b>click</b></span
><span class="key"><b>↓</b></span
><span class="key"><b>click</b></span
><span class="key"><b>End</b></span></span
></span
>
</div>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.