我正在Google Maps Platform上学习有关Google地图的知识,我想到了这部分使标记移动的代码。我是一个初学者,我真的需要理解代码的这一部分,有人可以分解一下代码并进行解释吗?
/**
* Animate an icon along a polyline
* @param {Object} polyline The line to animate the icon along
*/
function animateCircle(polyline) {
var count = 0;
// fallback icon if the poly has no icon to animate
var defaultIcon = [
{
icon: lineSymbol,
offset: '100%'
}
];
window.setInterval(function() {
count = (count + 1) % 200;
var icons = polyline.get('icons') || defaultIcon;
icons[0].offset = (count / 2) + '%';
polyline.set('icons', icons);
}, 20);
}
使您感到困惑的代码是什么?
((我的声誉尚不足以发表评论-仅'answer)