Igor-Vladyka / leaflet.motion

A simple tool to animate polylines and polygons in different way
https://igor-vladyka.github.io/leaflet.motion/
MIT License
207 stars 44 forks source link

When i use method named of 'addLatLng' , i got error "Uncaught TypeError: Cannot read property 'push' of undefined" #4

Closed shu681 closed 5 years ago

shu681 commented 5 years ago

Here is the part of code :

var motion = L.motion.polyline([], {
    color: '#ff0000'
}, {
    duration: duration,
    easing: L.Motion.Ease.easeInOutQuad
}, {
    removeOnEnd: false,
    icon: L.divIcon({
        html: "<i class='layui-icon layui-icon-top'></i>",
        iconSize: L.point(27.5, 24)
    })
}).addTo(map);

for (i in data) {
    var item = data[i];
    motion.addLatLng(L.latLng(item.lat, item.lng));
}
Igor-Vladyka commented 5 years ago

Hi there,

Plugin is pretty new so thank you for reporting that. It's fixed in latest version.