Depth Of Field Blur
A rack focus across depth planes. Install with npx remotion-ui@latest add depth-of-field-blur.
PrimitivePrimitivesAdvanced
$ npx remotion-ui@latest add depth-of-field-blurPull the audience's attention from one plane to another.
import { DepthOfFieldBlur } from "@/remotion/primitives/depth-of-field-blur";
<DepthOfFieldBlur
focusFrom={1}
focusTo={0}
layers={[
{ content: <Background />, depth: 1 },
{ content: <Card />, depth: 0.4 },
{ content: <Foreground />, depth: 0 },
]}
/>Where it sits
Spatial, unlike blur-focus-in, which resolves a single piece of type as it
arrives. Here every plane is blurred by its distance from the focal plane, so
racking the focus pulls one layer in exactly as it pushes another out. That
relationship is the shot; blurring one element on its own reads as an effect
rather than as a camera.
Two details that do the convincing
Defocused planes dim slightly, because a lens spreads the same light over a larger circle of confusion. And they scale slightly, which is the focus breathing every real lens has. Both are small enough to be invisible on their own and obvious by their absence.
aperture controls how fast focus falls off with distance. A high number is a
wide aperture: a plane goes soft over a very small change in depth.
Land the rack on a plane
Time the rack so it is on a plane whenever anyone is looking. A rack that is halfway between two planes at the moment a viewer's eye settles — or at the moment a thumbnail is captured — has nothing sharp in it, and an all-soft frame reads as a broken render rather than as a camera move.
The default runs across 78% of the surrounding window, starting at frame 6.
Override startAtInFrames and durationInFrames to place it against a beat, or
pass progress and drive it yourself.
Spatial, unlike `blur-focus-in`, which resolves one piece of type. Blur comes from each plane's distance to the focal plane, so racking pulls one layer in exactly as it pushes another out. Time the rack so it lands *on* planes: a rack that is between two planes at the moment anyone looks has nothing sharp in frame.
Agent notes
Install first, then import the copied source component locally. AI guide →
@/remotion/primitives/depth-of-field-blur- Use when: frame-level motion primitives and reusable animation wrappers.
- Customize: layers, focusFrom, focusTo, startAtInFrames, plus copied source for timing, layout, colors, and typography.
- Rule: do not import this component from the
remotion-uinpm package; it is copied into your project.
Usage
import { DepthOfFieldBlur } from "@/remotion/primitives/depth-of-field-blur";
<DepthOfFieldBlur
focusFrom={1}
focusTo={0}
layers={[
{ content: <Background />, depth: 1 },
{ content: <Card />, depth: 0.4 },
{ content: <Foreground />, depth: 0 },
]}
/>API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| layers | DepthOfFieldLayer[] | - | Back to front. Each is `{ content, depth }`, depth 0 nearest to 1 furthest. |
| focusFrom | number | 0 | Depth the lens starts focused on. |
| focusTo | number | 1 | Depth the lens racks to. Equal to `focusFrom` holds focus. |
| startAtInFrames | number | 6 | Frame the rack starts on. |
| durationInFrames | number | 78% of the window | Length of the rack. |
| maxBlur | number | 16 | Blur at maximum defocus, in px. |
| aperture | number | 2.2 | How fast focus falls off with distance. Higher is a wider aperture. |
| dim | number | 0.35 | How much an out-of-focus plane darkens. |
| breathe | number | 0.03 | Scale a defocused plane picks up — focus breathing. |
| progress | number | - | Drive the rack yourself, 0-1. |
| backgroundColor | string | "#07080e" | Plate behind every plane. |