(Nativescript + Google Maps SDK) Polyline gradient color

154 Views Asked by At

I'm developing an application over nativescript + vuejs that uses google maps sdk. The main behavior of the app includes draw a route between two geo-points.

I'm wondering, how can I draw that polyline with a gradient?

The function that renederizes the polyline:

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);
}

Thank you!

0

There are 0 best solutions below