DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> js實現googleMap中虛線的繪制方法
js實現googleMap中虛線的繪制方法
編輯:JavaScript綜合知識     
function drawPrePath(array,color){
  
  var sorrow={
  path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW //arrow
  };
  var lineSymbol = {
  path: 'M 0,-1 0,1',
  strokeOpacity: 1,
  scale: 3
  };
  var pathCoord = [
  new google.maps.LatLng(37.772323, -122.214897),new google.maps.LatLng(21.291982, -157.821856),
  new google.maps.LatLng(-18.142599, 178.431),new google.maps.LatLng(-27.46758, 153.027892)
  ];
  path = new google.maps.Polyline({
  path: pathCoord ,
  strokeColor:"#2d2d2d",
  strokeOpacity: 0,
  strokeWeight: 2,
  icons:[{icon:lineSymbol,offset: '0',repeat: '20px'}],
  map:map
  });
  path.setMap(map);
}
  var lineSymbol = {path: 'M 0,-1 0,1',strokeOpacity: 1,scale: 3};
關鍵在於’M 0,-1 0,1’ 其實這是SVG的繪制路徑的寫法,具體什麼意思我還解釋不清楚。嘻嘻 自己學svg教程吧!  
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved