Motion
How the word cursor and the sentence outline move, frame by frame.
Each highlight is a tween from what is on screen now to the new target. The interpolators are pure functions you can import and test (interpolateWord, interpolateSentence). Scrub through each kind of move:
Nearby words glide with a soft stretch capped at one box height. Distant words fade out and relocate instead of stretching across the text. Dashed: start and end. Faint: frames at even steps of eased time.
Nearby moves and long jumps
Nearby words glide with a soft stretch capped at one box height, rather than spanning both targets. Nearby line wraps keep that bounded stretch vertically. A distant word fades out in place, relocates while invisible, and fades in at its destination: no ribbon across the intervening text.
The distance policy uses the larger box height: a same-line gap over four heights, or a vertical centre separation over two heights, triggers relocation. Sentence outlines also relocate when their paired runs have no nearby lines, or their run counts differ. Nearby compatible sentence outlines still morph.
The default word corners use circular arcs with radius 4.5 and padding 1.5; the sentence defaults use radius 5 and padding 2. At a shared edge, the corners are concentric with an even 0.5-unit inset. Custom shape options can change that relationship.
Interruptions
A new target while a move is running starts a new tween from the current frame, not from the old target. Fast reading never queues moves up; the cursor bends toward the latest word.
Defaults
| Duration | Easing | |
|---|---|---|
| Word cursor | 240 ms | ease-out cubic |
| Sentence outline | 340 ms | ease-out cubic |
| Distant word / sentence relocation | 180 ms | ease-out cubic |
| Selection | 120 ms | ease-out cubic |
At 240 words per minute a word lasts 250 ms, so the cursor lands before the voice moves on. The nearby outline morph remains slower to draw the eye less; distant relocations finish in 180 ms by default. Explicit duration.word and duration.sentence values override both nearby and distant timing.
Reduced motion
With prefers-reduced-motion: reduce every highlight jumps. respectReducedMotion: false overrides it (for demos like this site's playground); animate: false turns motion off for everyone.
Without the highlighter
The geometry and motion are exported on their own, for a canvas renderer or another framework's tweens:
import { easeOutCubic, interpolateWord, wordPath } from "glyphline";
const tween = interpolateWord(current, { box: nextBox, o: 1 });
// each frame:
const f = tween(easeOutCubic(progress));
path.setAttribute("d", f ? wordPath(f.box) : "");The library started this way: Folio fed the same interpolators to Svelte's Tween.
Made by Lucas Piera