2012-11-12 87 views

回答

7

一旦你有StreetViewPanorama可以更新程序的位置或看這樣的觀點:

var panorama = map.getStreetView();// or new google.maps.StreetViewPanorama(div); 

// update position of StreetView 
panorama.setPosition(new google.maps.LatLng(42.345573,-71.098326)); 

// update the point of view 
panorama.setPov({ 
    heading: 34, 
    pitch: 10, 
    zoom: 1 
}); 
0

創建DIV地圖容器

<div id="panrama" style="width: 400px; height: 400px"></div> 

自動旋轉使用JavaScript:

var  pano; 
var  latlng = new google.maps.LatLng(38.897526, -77.0370613); 

var panoOptions = { 
    position: latlng, 
    pov: { 
     heading: 0, 
     pitch: 0 
    } 
}; 

pano = new google.maps.StreetViewPanorama(
    document.getElementById('panorama'), 
    panoOptions); 

window.setInterval(function() { 
    var pov = pano.getPov(); 
    pov.heading += 0.2; 
    pano.setPov(pov); 
}, 10); 

示例:Virtual Tour White House

Credits:theoryapp.com