Im trying to find a way to switch between map layers with transition.
Currently Im using the setOpacity method to switch between map layers which has helped to avoid the flickering that addLayer and removeLayer methods create. However I would like to be able to add some transition to ease the switch.
Was wondering if there is a way to do this? Thank you!
Update: I found a way to do so by adding a CSS class.
map2010.getContainer().className += `mapTransition`
map2022.getContainer().className += `mapTransition`
.mapTransition{
transition: opacity 0.7s ease;
}
Got the answer from here: https://gis.stackexchange.com/questions/195271/how-to-add-custom-css-class-to-leaflet-tilelayer