This is the documentation of version 0.64.0. 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, the way a lens focused there would. It is the one effect that reads the map's camera. In the playground below, the band holds one run 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
    'depthOfField.focus': 0,      // 0 = the nearest ground, 1 = the farthest the frame shows
    'depthOfField.band': 0.3,     // how much of that depth stays sharp
    'depthOfField.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 — the 3D terrain playground above — and with the fly-over plugin, as in the route fly-over playground, where it holds the road ahead in focus through the whole flight.

Related guides and examples

Related guides

Related examples