我是不是能夠得到GIF動畫看起來不錯,所以我想在此基礎上演示對「Localmind」的YouTube不同的方法。結果很不錯。 以下是我用來使其工作的代碼部分。請注意,我正在使用一些包裝和實用程序,因此您必須做一些翻譯或刪除部分。
// setup the selection state that is needed
var circle,
intervalWaitCount = 10,
startingStrokeWeight = 1,
circleOptions = {
radius: 0, // in meters
strokeOpacity: 1,
strokeColor: red,
strokeWeight: startingStrokeWeight,
fillOpacity: 0,
map: map,
center: marker.position
};
// remove from the last selected
if (components.MapWrapper.lastSelectedMarker) {
components.MapWrapper.lastSelectedMarker.circle.setVisible(false);
window.clearInterval(components.MapWrapper.lastSelectedMarker.interval);
}
if (marker.circle) {
marker.circle.setVisible(!marker.circle.getVisible());
circle = marker.circle;
} else {
circle = new google.maps.Circle(circleOptions);
marker.circle = circle;
}
marker.interval = window.setInterval(function() {
if (intervalWaitCount > 5) {
intervalWaitCount--;
return;
}
var radius = circle.getRadius();
circleOptions.strokeColor = green; // choose a color, I was changing based on a condition
circleOptions.center = marker.position;
if (radius <= 50000) {
circleOptions.strokeWeight = circleOptions.strokeWeight - 0.1;
circleOptions.radius = radius + 10000;
circle.setOptions(circleOptions);
// don't wait
intervalWaitCount = 0;
} else {
circleOptions.radius = 0;
circle.setOptions(circleOptions);
circleOptions.strokeWeight = startingStrokeWeight;
// wait five cycles before restarting the animation
intervalWaitCount = 10;
}
}, 100);
components.MapWrapper.lastSelectedMarker = marker;
閃爍標誌?這是什麼,1997? – Blazemonger 2012-03-16 16:43:19
mblase給出了一個解決方案.. – Vibing 2012-03-19 08:50:23
我無法忍受自己爲了讓互聯網更加醜陋而積分。 – Blazemonger 2012-03-19 13:02:29