JavaScript
mapboxgl.accessToken = 'pk.eyJ1IjoidHJpc3RlbiIsImEiOiJjajZoOXU4Z2kwNnppMnlxd2d6bTFvZ2xtIn0.PP7AoUakMfeqdXFHdsY0oA';
let toggle = false;
const lights = [{
"id": "directional",
"type": "directional",
"properties": {
"direction": [
"match",
["config", "lightPreset"],
"dawn",
["literal", [120, 50]],
"day",
["literal", [180, 20]],
"dusk",
["literal", [240, 80]],
"night",
["literal", [270, 20]],
["literal", [180, 20]]
],
"intensity": [
"interpolate",
["linear"],
["zoom"],
12,
[
"match",
["config", "lightPreset"],
"dawn",
0.5,
"day",
0.2,
"dusk",
0,
"night",
0,
0.2
],
14,
[
"match",
["config", "lightPreset"],
"dawn",
0.5,
"day",
0.2,
"dusk",
0.2,
"night",
0.5,
0.2
]
],
"cast-shadows": true,
"shadow-intensity": [
"match",
["config", "lightPreset"],
"night",
0.5,
1
],
"color": "hsl(0, 100%, 50%)"
}
},
{
"id": "ambient",
"type": "ambient",
"properties": {
"intensity": [
"match",
["config", "lightPreset"],
"dawn",
0.75,
"day",
0.8,
"dusk",
0.8,
"night",
0.5,
0.8
],
"color": "hsl(120, 100%, 25%)"
}
}
];
const style = {
version: 8,
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
sources: {},
layers: [],
imports: [{
id: 'standard',
url: 'mapbox://styles/mapbox/standard',
config: {'lightPreset': 'night'}
}]
};
const map = new mapboxgl.Map({
container: 'map',
style,
center: [-73.98705, 40.72516],
zoom:...