我有以下代码用于动画继续的路线,所以我需要折线但我不想显示它:
[..]
this.polyline = new google.maps.Polyline({
path: [],
strokeColor: '#ffffff',
strokeWeight: 0
});
[..]
折线与该代码一起显示。但我想让多段线透明 - 不可见!我该怎么做?
我将 strokeColor 设置为“透明”- 什么不起作用,或者当我完全删除该选项时也不起作用。我还将 strokeWeight 设置为 0 - 但这些参数没有任何效果。我还尝试了从 0.0 到 1.0 的 strokeOpacity - 也没有效果。知道有人解决吗? - PS:当我将颜色更改为#ff0000 时,颜色应该是红色的,对吗?但似乎这些选项根本不起作用 - 但显示了折线并且我在 console.log 中没有 JavaScript 错误......?
Here具有几乎相同示例的引用链接...
最佳答案
这对我有用:
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: '#FF0000',
strokeOpacity: 0.00001,
strokeWeight: 0
});
由于某些未知原因,strokeOpacity: 0.0 不起作用。
Simple polyline example from the Google Maps API v3 documentation
same code with a transparent polyline
Similar question about transparent polylines on FusionTablesLayers
关于javascript - google.maps.Polyline - 如何获得透明/不可见的折线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14288358/