mapbox-gl-js version: v0.44.2
The transition root property seems to have no effect (or I'm misunderstanding the concept of transition).
duration and delay of the transition root property significantly and compare with the behavior before the change.Example Style: style_5000.zip
The transition behavior changes according to the chosen values for duration and delay.
Transition behavior stays the same, regardless which values are chosen for duration and delay.
This jsbin example uses the example style (style_5000.zip) with the transition root property
"transition": {
"duration": 5000,
"delay": 5000
}
and the symbol layer itself has no transition settings, but the transition behavior of the text labels looks like the default:
"transition": {
"duration": 300,
"delay": 0
}
Some further testing shows that the transition root property has an effect e.g. when using map.setPaintProperty on map load.
http://jsbin.com/kutecapura/edit?html,output (5000 as value for duration and delay)
My expectation is that it should also have an effect for the first visually complete rendering of the map, so e.g. it would be possible to change the default "fade in duration" (300ms ?) of the text labels, right?
Updated demonstrations (v0.45.0 and style included):
Transition root property:
http://jsbin.com/fanihuqeni/edit?html,output
Transition root property + map.setPaintProperty
http://jsbin.com/bumajivoxa/edit?html,output
I am working on something similar where I would like to be able to change the text shading when you hover over an icon. Currently the text fades in and out which is visually jarring, so would ideally be able to turn off those transitions. Thanks!
Hm. There are two things at play here @pathmapper:
fadeDuration: 1000 as a map option). This option is currently not documented and is, notably, a global option — so it will apply to all symbols on the map, both in fadein and fadeout. We _may_ add more ways to customize label fading in the future but no concrete plans yet (cc @ChrisLoer).Erm, more helpfully (hopefully) @pathmapper: if the effect you're trying to achieve is the one you've suggested in the jsbins you provided (start with labels hidden, and fade them in slowly), you'll probably want to use a transitionable paint property like text-opacity to transition from 0 to 1. (Depending on your transition duration — if it's particularly fast — this could interplay strangely with label fading, but it sounds like you're not looking for faster transitions.)
Also, you may already know this, but it's not well-documented either, so I'll just note here: you can also set custom transition properties per-property (for transitionable properties), e.g.
"text-opacity": 0,
"text-opacity-transition": {
"duration": 5000,
}
and then you can leave the global transition setting alone for other layers/set transitions differently for different layers.
I'm going to close this because the issue on the tin has been resolved and I don't see other actionable items here — please open a new issue if you find unfiled transition bugs. Moving transition documentation action item to https://github.com/mapbox/mapbox-gl-js/issues/6689 + @ChrisLoer is going to document fadeDuration.
@maxwang7 from your description I'm not positive how you're using interactions, but in addition to the above suggestions you may be interested in following https://github.com/mapbox/mapbox-gl-js/issues/6692.
I ticketed fadeDuration documentation as https://github.com/mapbox/mapbox-gl-js/issues/6694.
Thank you so much @lbud for taking the time and writing it all down.
Now everything is clear.
Most helpful comment
Hm. There are two things at play here @pathmapper:
fadeDuration: 1000as amapoption). This option is currently not documented and is, notably, a global option — so it will apply to all symbols on the map, both in fadein and fadeout. We _may_ add more ways to customize label fading in the future but no concrete plans yet (cc @ChrisLoer).