Skip to main content
deleted 20 characters in body
Source Link
user1249791
  • 419
  • 2
  • 12

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 https://jsfiddle.net/perikut/Lpgtx43v/9/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)

I want my features to smoothly transition different to colors based on its data.

For this I apply a map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from a Maplibre jsfiddle

Mapboxgl seems to have same issue https://jsfiddle.net/perikut/Lpgtx43v/9/

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)

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)
added 139 characters in body
Source Link
user1249791
  • 419
  • 2
  • 12

I want my features to smoothly transition different to colors based on its data.

For this I apply a map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from thea Maplibre jsfiddle

Mapboxgl seems to have same issue https://jsfiddle.net/perikut/Lpgtx43v/9/

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)

I want my features to smoothly transition different to colors based on its data.

For this I apply a map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from the jsfiddle

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)

I want my features to smoothly transition different to colors based on its data.

For this I apply a map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from a Maplibre jsfiddle

Mapboxgl seems to have same issue https://jsfiddle.net/perikut/Lpgtx43v/9/

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)
Source Link
user1249791
  • 419
  • 2
  • 12

maplibregl/mapboxgl color transitions get lost after setPaintProperty

I want my features to smoothly transition different to colors based on its data.

For this I apply a map.setPaintProperty but then the 'fill-color-transition' property becomes lost, forever.. Some code from the jsfiddle

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)