JSFiddle - React, Tailwind, and code Playground
by nicolas tenorio
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry"></script>
<title>Street View service</title>
<body>
<div id="map-canvas" style="width: 400px; height: 300px"></div>
<div id="pano" style="position:absolute; left:410px; top: 8px; width: 400px; height: 300px;"></div>
<div id="pano1" style="position:relative; left:410px; top: 8px; width: 400px; height: 300px;"></div>
</body>
CSS
html,
body,
#map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
JavaScript
var panorama = null;
var fin;
function initialize() {
for(var i = 0.000001; i++; i/10000000)
{
console.log(i)
}
var fenway = new google.maps.LatLng(40.729884, (-73.990988 + i));
var mapOptions = {
center: fenway,
zoom: 14
};
var map = new google.maps.Map(
document.getElementById('map-canvas'), mapOptions);
var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'));
panorama.setPosition(fenway);
google.maps.event.addListenerOnce(panorama, 'status_changed', function() {
var heading = google.maps.geometry.spherical.computeHeading(panorama.getLocation().latLng, fenway);
panorama.setPov({
heading: heading,
pitch: 0
});
setTimeout(function() {
marker = new google.maps.Marker({
position: fenway,
map: panorama,
});
if (marker && marker.setMap) marker.setMap(panorama);
}, 500);
});
}
google.maps.event.addDomListener(window, 'load', initialize);