(Nativescript + Google Maps SDK)折线渐变颜色

时间:2020-03-31 18:09:37

标签: nativescript nativescript-vue google-polyline nativescript-google-maps-sdk

我正在开发使用google maps sdk的nativescript + vuejs应用程序。 该应用程序的主要行为包括在两个地理位置之间绘制路线。

我想知道如何绘制带有渐变的折线?

重新折线化的函数:

async drawRoute(mapView, encodedPolylinePoints) {
    mapView.removeAllPolylines();

    let routeCordinates = decodePolyline(encodedPolylinePoints);
    let polyline = new Polyline();

    await Promise.all(routeCordinates.map(point =>
        polyline.addPoint(Position.positionFromLatLng(point.lat, point.lng))
    ));

    polyline.visible = true;
    polyline.geodesic = true;
    polyline.width = 20;
    // polyline.color = new Color('#f8006c'); <= the start gradient color
    polyline.color = new Color('#f8b244'); // <= the end gradient color

    mapView.addPolyline(polyline);
}

谢谢!

0 个答案:

没有答案
相关问题