2013-10-08 4 views
0

아무도 폴링 라인을 계속 깜박이는 방법을 알려 줄 수 있습니까? Google지도에서 폴리선을 그렸습니다.하지만 그 다음 깜박 거리지 않습니다. 아래로Google지도에서 폴리 라인 깜박임

http://jsfiddle.net/wLeBh/8/

내 자바 스크립트 코드입니다.

function initialize() { 
    var center = new google.maps.LatLng(10.012552, 76.327043); 
    var myOptions = { 
     zoom: 16, 
     center: center, 
     mapTypeControl: true, 
     mapTypeControlOptions: { 
      style: google.maps.MapTypeControlStyle.DROPDOWN_MENU 
     }, 
     navigationControl: true, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
    } 
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 

    var polylineCoordinates = [ 
    new google.maps.LatLng(10.013566, 76.331549), 
    new google.maps.LatLng(10.013566, 76.331463), 
    new google.maps.LatLng(10.013503, 76.331313), 
    new google.maps.LatLng(10.013482, 76.331205), 
    new google.maps.LatLng(10.013419, 76.330926), 
    new google.maps.LatLng(10.013334, 76.330712), 
    new google.maps.LatLng(10.013313, 76.330411), 
    new google.maps.LatLng(10.013292, 76.330175), 
    new google.maps.LatLng(10.013228, 76.329854), 
    new google.maps.LatLng(10.013144, 76.329553), 
    new google.maps.LatLng(10.013059, 76.329296), 
    new google.maps.LatLng(10.012996, 76.329017), 
    new google.maps.LatLng(10.012869, 76.328802), 
    new google.maps.LatLng(10.012785, 76.328545), 
    new google.maps.LatLng(10.012700, 76.328223), 
    new google.maps.LatLng(10.012679, 76.328030), 
    new google.maps.LatLng(10.012658, 76.327837), 
    new google.maps.LatLng(10.012637, 76.327600), 
    new google.maps.LatLng(10.012573, 76.327322), 
    new google.maps.LatLng(10.012552, 76.327043), 

    ]; 
    var polyline = new google.maps.Polyline({ 
     path: polylineCoordinates, 
     strokeColor: '#FF3300', 
     strokeOpacity: 2.0, 
     strokeWeight: 5, 
     editable: false 
    }); 

    polyline.setMap(map); 
    var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png"); 
    new google.maps.Marker({ 
     position: polylineCoordinates[polylineCoordinates.length - 1], 
     icon: icon, 
     map: map, 
     clickable: false 
    }); 

} 



initialize(); 
+0

당신은 "깜박"무엇을 의미합니까? 너 뭐 해봤 니? – geocodezip

+0

내가 의미하는 바는 Google지도에 그려진 선이 일정 간격으로 깜박이는 것을 원한다는 것입니다. ..... 할 수는 없습니다 ..... –

+0

http://jsfiddle.net/SYEY4/1/ – geocodezip

답변

0

이 나를 위해 작동합니다

var map = null;  // and remove "var" from in front of the declaration in the initialize function 
var polyline = null; // and remove "var" from in front of the declaration in the initialize function 
function togglePolyline() { 
    if (polyline.getMap() == null) { 
    polyline.setMap(map); } 
    else { 
    polyline.setMap(null); } 
} 

setInterval(togglePolyline, 1000); 

fiddle

+0

우리는 어떤 좌표가 없기 때문에이 http://jsfiddle.net/wLeBh/20/에서 어떻습니까 –

+0

처음 질문에 대한 답변을 드리겠습니다. 또는 새로운 요구 사항에 맞는 대답을 수정 한 다음 어려움에 처했을 때 다른 질문을하십시오. – geocodezip

+0

죄송합니다 ...... –