Hi I need to create a method where the camera zooms for 5 seconds in a location and then dynamically changes to a location that I set. I ve implementing the zooming function where it zooms dynamically every 5000 ml but anyone can help on how I can make it for instance change location pause for 5sec and then rezoom to that location? Many thanks. here is my code.
var map;
function initialize() {
var latlng = new google.maps.LatLng(52.474, -1.868);
var myOptions = {
zoom: 1,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var bikeLayer = new google.maps.BicyclingLayer();
bikeLayer.setMap(map);
var curZoom = 1;
var zoomInterval;
// create map with zoom level curZoom
// ...
zoomInterval = setInterval(function () {
curZoom += 1;
map.setZoom(curZoom);
if (curZoom === 6) {
clearInterval(zoomInterval);
}
}, 5000);
}
google.maps.event.addDomListener(window, 'load', initialize);
Use
map.setCenter()
in yoursetInterval()
function. You probably have predefined locations, so you need to use them insetCenter()
function.Example usage with predefined locations: