Attaches the effects to a map. Nothing is visible until a knob turns an effect on.
The map to render effects over.
Optionalsettings: MapEffectsSettings
Effect knob values to apply right away.
Runs a GPU pass of your own in the effects chain, ahead of every overlay effect, and in capture as on screen. Passes run in the order they were added, within their placement.
A pass redraws with the map. If its uniforms change on their own, as in a time-driven animation,
ask for frames with map.mapLibreMap.triggerRepaint(). A pass that shifts hues runs before
bloom's colour key too, so a bloom.only scope may need a wider bloom.onlyTolerance.
Replaces every knob with the given settings. An empty object turns everything off. Values are validated against the catalogue before anything is touched.
Renders the current view, with its effects, into a canvas, optionally at a higher pixel ratio for print. The map is re-rendered at that ratio (never resampled), read back once every tile is drawn, and then set back to the ratio it had.
Optionaloptions: CaptureOptionsReturns the knobs set, as a plain serializable object.
Detaches the effects from the map, removes their elements and releases the WebGL context the chain holds. A page with several maps needs this, since a browser caps how many contexts it may keep alive.
Takes a pass added with addPass out of the chain. An id with no pass is ignored.
Resets every knob to its default, off for most effects.
Changes the given knobs and keeps the rest, as a map module's updateConfig does.
Practical post-processing for a TomTomMap, with effects computed from the rendered map's own pixels rather than its style. They therefore work on every style, survive every style release, and cannot be reproduced by editing the style at all.
Remarks
Every effect is named by the problem it solves, and off by default:
Effects render live as layers over the map canvas, and are composited the same way into capture, so what is captured is what was on screen. From the bottom, the layers are a WebGL2 chain that also runs your own passes from addPass, bloom as a small canvas blended in
screenmode, and the CSS overlays.Bloom, the depth of field, your passes and capture read the map canvas, which needs
mapLibre: { canvasContextAttributes: { preserveDrawingBuffer: true } }when creating the map. The plugin warns once when it is missing.effectKnobCatalogue lists every knob as static data, the way
stylingFoundationsKnobCataloguelists the SDK's styling knobs. The SDK'ssetKnob,getKnobandresetKnobset, read and unset one by its id, as on a map module.Example