Typing
Types text into the frame one character at a time, so the viewer reads along as it appears.
Rendered video, with motion blur.
Your first line
Your next line
Another line
A short line
Done
0.00 / 3.10 s
Live preview, driven by the code below. No motion blur.
What it does
Characters appear one at a time. The caret stays solid while typing and blinks every 0.53 s at rest.
Curve
Power 1.2
Values
S is the frame's short side, 1080 px at 1080p. Unmeasured inputs in the preview are illustrations, not rules.
| Fact | Value |
|---|---|
Purpose | Build |
Acts on | Line |
Typical length | 3.1 s (93 frames at 30 fps), for five prompts |
Caution | Type one character at a time, never in blocks. |
| Property | Value |
|---|---|
Speed | Steady (15 to 18 characters a second) or Accelerating |
Accelerating line durations | 1.25, 0.8, 0.5, 0.33, 0.22 s, typed share p^1.2 |
Old line lift | 3.7% S (40 px) |
Old line fade | 0.09 s |
New line rise | 0.19 s |
Caret: Rest blink | Every 0.53 s |
Caret: Width | 0.46% S (5 px) |
Caret: Height | 1.05 em |
Caret: Colour | Ink |
Export samples | 12; 1 when still |
Typing into a field
| Property | Value |
|---|---|
Focus | The field shows its focus ring 0.15 s before the first character |
Caret while waiting | Blinks 0.53 s on, 0.53 s off (the common system rate) |
Caret while typing | Stays solid |
After the last character | Hold 0.3 s, then Press on the send button, then the field clears in 0.15 s |
Code
ts
export const seg = (t: number, a: number, b: number) => Math.max(0, Math.min(1, (t - a) / (b - a)));
export const lerp = (a: number, b: number, k: number) => a + (b - a) * k;
export const out = (k: number) => (k >= 1 ? 1 : 1 - Math.pow(2, -10 * k));
export const io = (k: number) => (k < 0.5 ? 16 * k ** 5 : 1 - Math.pow(-2 * k + 2, 5) / 2);
export const inn = (k: number) => k * k * k;
export const cubicOut = (k: number) => 1 - Math.pow(1 - k, 3);
export const h = (i: number, j: number) => { const x = Math.sin(i * 127.1 + j * 311.7) * 43758.5453; return x - Math.floor(x); };
export const phase = (t: number, start = 0, duration = 0.6) => seg(t, start, start + duration);
export const easeInOut = (p: number) => p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2;
export const TYPING_DURATIONS = [1.25, 0.8, 0.5, 0.33, 0.22];
export function acceleratingTyping(t: number, index = 0) {
const start = TYPING_DURATIONS.slice(0, index).reduce((a, b) => a + b, 0);
const duration = TYPING_DURATIONS[index] ?? 0.22;
const p = phase(t, start, duration);
const exit = phase(t, start + duration, 0.09);
const enter = out(phase(t, start, 0.19));
return { typed: p ** 1.2, y: 40 * (1 - enter) - 40 * exit, opacity: enter * (index === 4 ? 1 : 1 - exit) };
}
export function caret(t: number, typing: boolean) {
return { opacity: typing || Math.floor(Math.max(0, t) / 0.53) % 2 === 0 ? 1 : 0, width: 5, heightEm: 1.05 };
}Rejected variants
| Tried | Verdict |
|---|---|
Accent on the end of every sentence, accent cursor | Rejected |
Typing in blocks at a linear pace | Rejected: accelerating, letter by letter |
Best practices
| Use it for | Avoid | Rejected before |
|---|---|---|
Repeated prompts | Typing in blocks | Typing in blocks at a linear pace |
A sequence gathering pace | A constant typing pace | Accent on the end of every sentence, accent cursor |
Typing text | Accent colour | |
A resting input | Unrelated decoration |
Reduced motion: a simple opacity fade over 0.2 s.