1.加载图层时,图标透明度设置为1.0
paint: {
'icon-opacity':1.0,
'text-color': 'rgba(255, 255, 255, 0.97)'
}
2.闪烁某个要素图标
var time1 = setTimeout(function(){
that.map.setPaintProperty('layerid', 'icon-opacity',
['case', ['match', ['get', 'id'], id, true, false], 0.5, 1]);
},500)
var time2 = setTimeout(function(){
that.map.setPaintProperty('layerid', 'icon-opacity',1);
},1000)
var time3 = setTimeout(function(){
that.map.setPaintProperty('layerid', 'icon-opacity',
['case', ['match', ['get', 'id'], id, true, false], 0.5, 1]);
},1500)
var time4 = setTimeout(function(){
that.map.setPaintProperty('layerid', 'icon-opacity',1);
},2000)
3.清除定时器
clearTimeout(this.time1)
效果图