(Nativescript + Google Maps SDK) Цвет градиента полилинии - PullRequest
0 голосов
/ 31 марта 2020

Я разрабатываю приложение поверх nativescript + vuejs, которое использует google maps sdk . Основное поведение приложения включает в себя рисование маршрута между двумя географическими точками.

Мне интересно, как я могу нарисовать эту полилинию с градиентом?

Функция, которая переопределяет полилинию:

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

Спасибо!

...