Slide in

Brings something in from the side, for panels, cards and lists.

Rendered video, with motion blur.

0.00 / 2.00 s

Live preview, driven by the code below. No motion blur.

What it does

The item travels in from one side and eases to rest; it leaves the same way, faster.

Curve

Cubic out

Values

S is the frame's short side, 1080 px at 1080p. Unmeasured inputs in the preview are illustrations, not rules.

FactValue
Purpose
Enter, exit
Acts on
Card, window
Typical length
0.5 to 0.6 s (15 to 18 frames at 30 fps)
Caution
One direction per scene.
PropertyValue
Start
8 to 15% S away (86 to 162 px), or from the frame edge
Duration
0.5 to 0.6 s
Curve
Ease-out cubic
Exit
Ease-in, 0.4 s
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 slideIn(t: number, start = 0, duration = 0.55, from = -130) {
  const k = cubicOut(phase(t, start, duration));
  return { x: from * (1 - k), opacity: phase(t, start, duration * 0.4) };
}

export function slideOut(t: number, start = 0, duration = 0.4, to = 130) {
  const k = inn(phase(t, start, duration));
  return { x: to * k, opacity: 1 - k };
}

Best practices

Use it forAvoid
Panels, cards and list rows
More than one direction in a scene
Side drawers in product UI
Sliding headlines across the whole frame

Reduced motion: a simple opacity fade over 0.2 s.