Cards sit on a dark gradient that comes in from one side of the frame. Getting its reach, softness and blur right makes the cards readable, keeps the speaker clear, and quietly hides weak detail in generated background people.
The gradient
Apply per frame (1920×1080, frames as float32 RGB arrays). g is the gradient's
fade-in (0–1) at time t.
import numpy as np
from PIL import Image, ImageFilter
W, H = 1920, 1080
x = np.linspace(0, 1, W)
def side_grad(side, reach=0.62, soft=0.37, gamma=1.1, gmax=0.9):
"""Darkness 0..gmax, darkest at the edge it comes from; fades out `reach` of the width in."""
r = np.clip((x - (1 - reach)) / soft, 0, 1) if side == "right" else np.clip((reach - x) / soft, 0, 1)
return np.repeat(((r ** gamma) * gmax)[None, :, None], H, axis=0).astype(np.float32)
def ease(v):
v = min(max(v, 0.0), 1.0)
return v * v * (3 - 2 * v)
def reach_at(t, keys):
"""keys [[t, reach], ...]: the reach eased between keys (follows a camera move)."""
if t <= keys[0][0]:
return keys[0][1]
for (t0, r0), (t1, r1) in zip(keys, keys[1:]):
if t <= t1:
return r0 + (r1 - r0) * ease((t - t0) / (t1 - t0))
return keys[-1][1]
def apply(frame, grad, g, blur=0):
a = frame
if blur and g > 0:
# soft blur under the gradient, strongest where it is darkest (a shallow-focus look behind the card)
b = np.asarray(Image.fromarray(a.astype(np.uint8)).filter(ImageFilter.GaussianBlur(blur)), np.float32)
m = np.clip(grad / max(float(grad.max()), 1e-6), 0, 1) * g
a = a * (1 - m) + b * m
return a * (1 - grad * g)
Draw the card on top (label, letter-spaced, with a short rule; text or list in a bold neue grotesk, white). Its panel is about 720 px wide, 110 px from the gradient's edge, and vertically centred.
Settings that worked
| Use | reach | soft | gamma | blur |
|---|---|---|---|---|
| Close-ups, two-shots (default) | 0.62 | 0.37 | 1.1 | 0 |
| Wide shots with people behind the card | 0.68 | 0.26 | 0.8 | 3 px |
- Reach: take it just short of the speaker. The person asked for it to reach "a little further"; 0.68 stopped just short of her.
- Darker further out: a lower soft and gamma keep it darker for longer before it fades. That hid a background person whose generated face looked "a little funky".
- Blur: 10 px was too blurry, 6 px was still "a little less blurry, please", and 3 px was approved. Blending by the gradient's own mask keeps the speaker sharp.
- The same settings on every shot of the same framing, so the edge doesn't jump between shots. Show one shot first with two looks (darker, or darker plus blur) and apply the pick to all of them.
- Across a camera push from a wide to a close-up, ease the reach with keys
(
[[move_start, 0.68], [move_end, 0.62]]) so it meets the close-up's value without a jump at the cut. - Keep the clip's audio: map the source's audio through when encoding.
Check
Look at a sheet of frames from every carded shot side by side: the gradient's edge should sit in the same place, the speaker's face should be outside it, and the text should be readable over the brightest background.


