我正在开发使用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);
}
谢谢!