【问题标题】:google.maps.Polyline - how to get a transparent / invisible polyline?google.maps.Polyline - 如何获得透明/不可见的折线?
【发布时间】:2023-03-23 13:18:01
【问题描述】:

我有以下代码用于动画进行的路线,所以我需要折线,但我不想显示它:

[..]
    this.polyline = new google.maps.Polyline({
                path: [],
                strokeColor: '#ffffff',
                strokeWeight: 0
            });
[..]

折线与该代码一起显示。但我想让折线透明 - 不可见!我该怎么做?

我将 strokeColor 设置为“透明” - 什么不起作用,或者当我完全删除该选项时也不起作用。我还将 strokeWeight 设置为 0 - 但这些参数无效。我也尝试了 strokeOpacity 从 0.0 到 1.0 - 也没有效果。知道有人解决方案吗? - PS:当我将颜色更改为#ff0000 时,颜色应该是红色的,对吗?但似乎这些选项根本不起作用 - 但是显示了折线并且我在 console.log 中没有 JavaScript 错误...?

Here 引用的链接与几乎相同的示例...

【问题讨论】:

    标签: javascript google-maps-api-3 colors transparent polyline


    【解决方案1】:

    这对我有用:

        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

    【讨论】:

      猜你喜欢
      • 2013-04-30
      • 1970-01-01
      • 1970-01-01
      • 2016-09-14
      • 1970-01-01
      • 1970-01-01
      • 2012-08-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多