Javascript 谷歌地图上未显示动画符号

Javascript 谷歌地图上未显示动画符号,javascript,google-maps,Javascript,Google Maps,我想在谷歌地图上制作一个“car.png”符号的动画,但我做不到。这是我的密码 var line; function initialize() { var mapOptions = { center: new google.maps.LatLng(20.291, 153.027), zoom: 6, mapTypeId: google.maps.MapTypeId.TERRAIN }; var map = new google.maps.Map(document.getElementById

我想在谷歌地图上制作一个“car.png”符号的动画,但我做不到。这是我的密码

var line;

function initialize() {
var mapOptions = {
center: new google.maps.LatLng(20.291, 153.027),
zoom: 6,
mapTypeId: google.maps.MapTypeId.TERRAIN
};

var map = new google.maps.Map(document.getElementById('map-canvas'),
  mapOptions);

var lineCoordinates = [
new google.maps.LatLng(22.291, 153.027),
new google.maps.LatLng(18.291, 153.027)
];

// Define the symbol, using one of the predefined paths ('CIRCLE')
// supplied by the Google Maps JavaScript API.
var lineSymbol = {
path: 'images/car.png',
scale: 8,
strokeColor: '#393'
};
line = new google.maps.Polyline({
path: lineCoordinates,
icons: [{
  icon: lineSymbol,
  offset: '100%'
}],
map: map
 });

animateCircle();
}

function animateCircle() {
var count = 0;
window.setInterval(function() {
  count = (count + 1) % 200;

  var icons = line.get('icons');
  icons[0].offset = (count / 2) + '%';
  line.set('icons', icons);
 }, 20);
}

google.maps.event.addDomListener(window, 'load', initialize);
我应该换什么工作?
我希望汽车符号移动,地图的中心也随之改变,以便每次都显示该符号。

您使用的代码需要一个图像(car.png)


谢谢。是否仍要使用图像而不是svg符号来制作动画?使用自定义图标执行类似或但的操作。
// Define the symbol
var lineSymbol = {
path: "M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0",
fillColor: '#FF0000',
fillOpacity: .6,
anchor: new google.maps.Point(0,0),
scale: .8,
strokeColor: '#393'
};