RemotionUI

Depth Of Field Blur

A rack focus across depth planes. Install with npx remotion-ui@latest add depth-of-field-blur.

PrimitivePrimitivesAdvanced

depth-of-field-blur30fps · 960×540
Install
$ npx remotion-ui@latest add depth-of-field-blur

Pull 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 →

Import
@/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-ui npm package; it is copied into your project.

Usage

Example
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

PropTypeDescription
layersDepthOfFieldLayer[]Back to front. Each is `{ content, depth }`, depth 0 nearest to 1 furthest.
focusFromnumberDepth the lens starts focused on.
focusTonumberDepth the lens racks to. Equal to `focusFrom` holds focus.
startAtInFramesnumberFrame the rack starts on.
durationInFramesnumberLength of the rack.
maxBlurnumberBlur at maximum defocus, in px.
aperturenumberHow fast focus falls off with distance. Higher is a wider aperture.
dimnumberHow much an out-of-focus plane darkens.
breathenumberScale a defocused plane picks up — focus breathing.
progressnumberDrive the rack yourself, 0-1.
backgroundColorstringPlate behind every plane.

Related

On this page