2011-09-25 7 views
1

센터의 중심이 모두 인 초로 어떻게 Google지도를 만들 수 있습니까?매초마다 변경되는 Google지도가 있습니까?

<!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는'초마다 증가 시킨다는 것을 확인 ( http://test.barrycarter.info/sunstuff2.html에도)하지만,이 행 : 나는 다음 시도

x.center = new google.maps.LatLng(j,0); 

는 아무것도 실시하지 않습니다. google.maps.PleaseRedrawThisObjectBecauseIHaveChangedStuff 메소드가 있습니까?

답변

1

API 함수는 일반적으로 수동으로 속성을 설정하는 것을 지원하지 않습니다. 다음과 같이 getter/setter 함수를 사용해보십시오.

x.setCenter(new google.maps.LatLng(j, 0)); 
관련 문제