This is the documentation of version 1.0.0-rc.3. Go to the latest version, 1.0.0-rc.5.

Depth of field

The map effects plugin's depthOfField holds one distance sharp on a pitched map and defocuses the rest, as a lens focused there would. It is the only effect that reads the map's camera. In the playground below, the band keeps one stretch of the valley in focus and lets the ridges behind it soften:

Turning it on

effects.updateConfig({
    depthOfField: {
        intensity: 18, // the widest circle of confusion, in CSS pixels
        focus: 0,      // 0 = the nearest ground, 1 = the farthest the frame shows
        band: 0.3,     // how much of that depth stays sharp
        bokeh: 0.5,    // whether a defocused highlight fades or returns as a disc
    },
});
Knob Range Default
depthOfField.intensity (CSS px) 0–30 0 (off)
depthOfField.focus (0 = nearest, 1 = farthest shown), depthOfField.band 0–1 0, 0.3
depthOfField.bokeh 0–1 0.5

How it works

Planning around it

It pairs with 3D terrain, which gives the view relief to defocus, as in the 3D terrain playground above. With the fly-over plugin, as in the route fly-over playground, it holds the road ahead in focus through the whole flight.

Related guides and examples

Related guides

Related examples