I want my features to smoothly transition different to colors based on its data.
For this I apply a new map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from a Maplibre jsfiddle
Mapboxgl seems to have same issue jsfiddle mapbox
layer paint property:
paint: { 'fill-color-transition': { duration: 3700 }, 'fill-color': 'blue', 'fill-opacity': .6 } //it properly smoothly changes the colors map.setPaintProperty('polygons-layer','fill-color','orange') map.setPaintProperty( 'polygons-layer', 'fill-color', [ 'match', ['get', 'id'], 1, 'red', 'gray' ], 'rgba(236, 235, 235, 0.1)' // Default color for all other cases ); setTimeout(function() { //transition not working anymore map.setPaintProperty('polygons-layer', 'fill-color', 'orange') }, 2000)