Gradient drift
A background that is quietly alive without drawing the eye.
Rendered video, with motion blur.
0.00 / 12.00 s
Live preview, driven by the code below. No motion blur.
What it does
Two or three soft colour fields drift slowly in a loop behind the content.
Curve
Linear
Values
S is the frame's short side, 1080 px at 1080p. Unmeasured inputs in the preview are illustrations, not rules.
| Fact | Value |
|---|---|
Purpose | Loop |
Acts on | Background |
Typical length | 8 to 16 s (240 to 480 frames at 30 fps), per loop; runs the whole scene |
Caution | One colour family, low contrast, and always behind content. |
| Property | Value |
|---|---|
Fields | Two or three soft colour fields |
Loop | Linear, 8 to 16 s |
Travel | Each field moves no more than 10% of the frame |
Colour | Within one colour family of the brand's ground, low contrast behind content |
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 function gradientDrift(t: number, field: number, period = 12, width = 1920, height = 1080) {
const a = 2 * Math.PI * (t / period + field / 3);
return { x: 0.05 * width * Math.cos(a), y: 0.05 * height * Math.sin(a) };
}Best practices
| Use it for | Avoid |
|---|---|
Held scenes, title cards and end cards | Several colour families or high contrast |
Backgrounds behind product UI | Fields drifting over content |
Reduced motion: a simple opacity fade over 0.2 s.