Chat sequence
Messages arrive one at a time, the way a real conversation reads.
Rendered video, with motion blur.
Summarise this thread
Three key points
Thanks
0.00 / 6.40 s
Live preview, driven by the code below. No motion blur.
What it does
Each bubble grows in from its tail corner as older messages slide up to make room; a typing indicator shows before each reply.
Curve
Cubic out
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 | Card, group |
Typical length | 0.3 s (9 frames at 30 fps), per message, plus its read time |
Caution | Use the product’s real messages, and never more than four on screen. |
| Property | Value |
|---|---|
Bubble arrives | Fades in, rises 1.1% S (12 px) and scales 0.92 to 1 in 0.3 s, ease-out cubic, from its tail corner |
Older messages | Slide up to make room in 0.3 s, ease-in-out cubic, at the same moment |
Typing indicator | 0.6 to 1.2 s before a reply; dots pulse in turn, 0.15 s apart, on a 0.9 s loop |
Gap before the next message | Hold formula for the message just shown (0.75 s + words / 2.5 + 0.5 s, minimum 1.2 s) |
On screen | At most 4 messages |
Export samples | 12; 1 when still |
Starting values from research. Measure against a reference before relying on them.
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 holdTime = (words: number) => Math.max(1.2, 0.75 + words / 2.5 + 0.5);
export function chatBubble(t: number, start: number) {
const k = cubicOut(phase(t, start, 0.3));
return { y: 12 * (1 - k), scale: lerp(0.92, 1, k), opacity: k };
}
export const chatLift = (t: number, laterArrivals: number[], step: number) => ({ y: -step * laterArrivals.reduce((sum, a) => sum + easeInOut(phase(t, a, 0.3)), 0) });
export function typingDot(t: number, dot: number) {
const p = (((t - dot * 0.15) % 0.9) + 0.9) % 0.9 / 0.9;
return { opacity: 0.35 + 0.65 * Math.max(0, Math.sin(Math.PI * Math.min(1, p * 2.5))), y: -8 * Math.max(0, Math.sin(Math.PI * Math.min(1, p * 2.5))) };
}Best practices
| Use it for | Avoid |
|---|---|
Chat, support and AI assistant products | Invented messages; use the product's real ones |
Showing a reply arrive after a question | More than four messages on screen |
Reduced motion: a simple opacity fade over 0.2 s.