我目前正在使用leaflet,leaflet运动插件来制作折线的动画。
现在,我需要在运动动画完成后显示一个弹出窗口。
怎样才能捕捉到运动结束事件。
从文档中,我可以看到L.Motion.Event.Ended事件将在运动结束后触发。
但我无法获得此运动结束事件。
有谁可以帮助捕捉传单运动中的运动结束事件。
发布于 2020-12-07 23:59:11
我刚想通了。一旦创建了motion对象,您就可以像这样监听它:
var route = L.motion.polyline(pol, {
color: "steelblue",// + Math.floor(Math.random()*16777215).toString(16),
weight:4
},
{
auto:false,
duration:this.route_speed
},
{
removeOnEnd: true,
icon: L.divIcon({
className: 'custom-div-icon',
html: "<i class='fas fa-map-pin' style='color:red; font-size: 20px;'></i>",
iconSize: [30, 42],
iconAnchor: [5, 20]
})
}).addTo(this.map);
this.routes.push(route);
route.on('motion-started', (e) => {
console.log("START")
})
route.on('motion-ended', (e) => {
console.log("END")
})https://stackoverflow.com/questions/63160120
复制相似问题