javascript - 如何在mapbox gl中为圆形类型添加框阴影?
问题描述
我有以下风格:
var styles = [{
"id": 'points',
"interactive": true,
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": 5,
"circle-color": "#000
},
"filter": ["in", "$type", "Point"]
}, {
"type": "line",
"source": "geojson",
"layout": {
"line-cap": "round",
"line-join": "round"
},
"paint": {
"line-color": "#000",
"line-width": 2.5
},
"filter": ["in", "$type", "LineString"]
}];
我需要将“0 9px 2px 0 rgba(0,0,0,0.20)”的框阴影值添加到圆圈中以赋予它们阴影效果。有什么办法可以做到吗?
解决方案
您可以添加另一个图层并使用更大的半径制作阴影并设置模糊。
像这样的东西:
{
"id": "points_shadow",
"interactive": true,
"type": "circle",
"source": "geojson",
"paint": {
"circle-radius": 10,
"circle-color": "#000",
"circle-blur": 0.4
},
"filter": ["in", "$type", "Point"]
}
或者您应该使用 3D 坐标并设置它们的样式fill-extrusion
希望对你有效。
推荐阅读
- sql-server-2008 - 第 11 行 '2' 附近的语法不正确。第 11 行是“@processdate”变量
- corda - 可以连接两个corda网络吗?
- javascript - 使用回调(胖箭头函数)作为函数参数解释示例
- jquery - 如何仅在显示时关闭 div
- javascript - 从表中获取选定的复选框值并将这些值传递给 ajax
- typescript - 在打字稿中转换 javascript 代码以创建简单的金字塔
- ios - 我的所有开发人员和分发证书都显示为不受信任
- xamarin - 如何在 xamarin 表单中绘制从起始位置到结束位置的路线
- cassandra - 基于令牌范围的分区键查询的性能?
- laravel - Response.php 第 458 行中的 InvalidArgumentException:HTTP 状态代码“1”无效