Wykks / ngx-mapbox-gl

Angular binding of mapbox-gl-js
https://wykks.github.io/ngx-mapbox-gl
MIT License
343 stars 139 forks source link

Showing ripple effect at specified lat lng with MapCircleView #285

Open bashasm opened 3 years ago

bashasm commented 3 years ago

I am using Mapbox library and planning to upgrade to ngx-mapbox-gl to simplify the code

Here is the code for showing ripple at specified lat lng, it also needs mapGrahpicView to add MapCircleView ( i am thinking upgrading to ngxmapboxgl will avoid using this)

export const ripple = (color: Color, lngLat: mapboxgl.LngLat, mapView: MapGraphicView) => {
    if (document.hidden) {
        return;
    }
    const ripple = new MapCircleView()
        .center(lngLat)
        .radius(0)
        .fill(null)
        .stroke(color.alpha(1))
        .strokeWidth(1);

    // we need view on the map canvas!
    mapView.appendChildView(ripple);
    const radius = rippleRadius(8);

    const tween = Transition.duration<any>(5000);
    ripple.stroke(color.alpha(0), tween).radius(
        radius,
        tween.onEnd(function() {
            ripple.remove();
        })
    );
};

Please advise

bashasm commented 3 years ago

Any suggestions? Please advise

bashasm commented 3 years ago

Any advice?