1
如何創建一個圈子,其中心每隔 秒更改一次Google地圖?我試過如下:(也在 http://test.barrycarter.info/sunstuff2.html)谷歌地圖w /每秒都在變化的圈子?
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function updateJ() {
j = j+0.5;
x.center = new google.maps.LatLng(j,0);
}
function initialize() {
var myLatLng = new google.maps.LatLng(0,0);
var myOptions = {zoom:2,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
j = 20.18
x = new google.maps.Circle({
center: new google.maps.LatLng(j,-18.5037550725315),
radius: 10018760,
map: map,
strokeWeight: 2,
fillOpacity: 0.2,
fillColor: "#ffffff"
});
}
</script>
</head>
<body onload="initialize(); updateJ(); setInterval('updateJ()', 1000)">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
螢火證實, 'J' 增加每一秒,但此行:
x.center = new google.maps.LatLng(j,0);
什麼都不做。有沒有google.maps.PleaseRedrawThisObjectBecauseIHaveChangedStuff方法?