JSFiddle - React, Tailwind, and code Playground
by Lawrence Ross
HTML
<script src="https://maps.googleapis.com/maps/api/js?libraries=geometry,places&ext=.js"></script>
<script src="https://cdn.rawgit.com/googlemaps/v3-utility-library/fb56a0dc/markerwithlabel/src/markerwithlabel.js"></script>
<div id="map_canvas"></div>
<img src="http://www.geocodezip.com/mapIcons/SO_20170925_multiplePaths_mod.svg" />
CSS
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
.mapLabels {
color: "white"
}
JavaScript
var geocoder;
var map;
function initialize() {
var map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
optimized: false,
icon: {
url: "http://www.geocodezip.com/mapIcons/SO_20170925_multiplePaths_mod.svg",
anchor: new google.maps.Point(39, 60),
size: new google.maps.Size(150, 150)
},
});
var measle = new google.maps.Marker({
position: map.getCenter(),
map: map,
optimized: false,
icon: {
url: "https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle.png",
size: new google.maps.Size(7, 7),
anchor: new google.maps.Point(3.5, 3.5)
}
})
var rotationAngle = 10;
google.maps.event.addListenerOnce(map, 'idle', function() {
setInterval(function() {
console.log("transform: rotate(" + rotationAngle + 'deg)'); $('img[src="http://www.geocodezip.com/mapIcons/SO_20170925_multiplePaths_mod.svg"]').css({
'transform': 'rotate(' + rotationAngle + 'deg)',
'transform-origin': '39px 60px'
});
rotationAngle += 10;
rotationAngle %= 360;
}, 1000);
});
}
google.maps.event.addDomListener(window, "load", initialize);