Google maps 我可以在谷歌地图API上使用我自己的自定义动画GIF作为标记吗?
我想使用不同的动画图像(GIF)作为谷歌地图上的标记;我可以用API来做这件事吗?我假设您可以这样做:Google maps 我可以在谷歌地图API上使用我自己的自定义动画GIF作为标记吗?,google-maps,google-maps-api-3,google-maps-markers,Google Maps,Google Maps Api 3,Google Maps Markers,我想使用不同的动画图像(GIF)作为谷歌地图上的标记;我可以用API来做这件事吗?我假设您可以这样做: function showMarkerFeature(p) { var oF = new google.maps.Marker({ map: map, position: p, //set the image src path here icon: "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-
function showMarkerFeature(p) {
var oF = new google.maps.Marker({
map: map,
position: p,
//set the image src path here
icon: "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png"
});
identifyMarker.setVisible(false);
map.setCenter(p);
return oF;
}
是的,你可以):
创建标记时,只需使用图标:图标url
更新:
marker = new google.maps.Marker({
map:map,
draggable:false,
optimized:false, // <-- required for animated gif
animation: google.maps.Animation.DROP,
position: position,
icon: "http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-01-35/e8nZC.gif"
});
marker=new google.maps.marker({
地图:地图,
可拖动:错误,
optimized:false,//好的,太好了!我看到您在示例中使用了*.png,但我也可以使用动画*.gif?我刚刚尝试根据上面的示例添加以下*.gif,但*.gif没有显示任何移动:(我找到了答案;我必须添加优化:false。我已经更新了答案供将来参考,感谢您的努力:-)
marker = new google.maps.Marker({
map:map,
draggable:false,
optimized:false, // <-- required for animated gif
animation: google.maps.Animation.DROP,
position: position,
icon: "http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-01-35/e8nZC.gif"
});