rubenspgcavalcante/leaflet-ant-path

Can we use this as a simple cdn plugin?

rainitesh opened this issue · 3 comments

Can we use this as a simple cdn plugin?

I have declared this in my html file
<script src="js/leaflet-ant-path.js"></script>

and this is my current code -

    var coords = [];
    var test = [
    [
    144.6689987182617,
    -37.88948610493191
    ],
    [
    144.7089958190918,
    -37.872820842567876
    ]
    ];
    var options = {
        "color": "#4017e3",
        "weight": 5,
        "pulseColor": "#FF00FF",
        "paused": false,
        "delay": 120,
        "dashArray" : [15,30]
    };   
    var outerVicroadsMap = L.geoJson( bikeData,{
        onEachFeature: function (feature, layer) {         
         coords.push(feature.geometry.coordinates);
     }       
 }); 
    console.log(coords[0][0]);
    console.log(test);
    let antPolyline = new L.Polyline.AntPath(test, options);
    console.log(antPolyline);
    antPolyline.addTo(map);

});

I tried animating both coords and test polyline but none are rendering on the map. I can't see any errors on the map. I also see the antPolyline object in the console which seems right.

Any help is appreciated.

Did you ever get this resolved? Your array should be [lat, long] not [long, lat].

@dcherniy Yes I got it working. Cheers.