嗨,我是谷歌街景 api 和 javascript 的新手。我正在尝试编写一个代码,通过它我可以在特定的经度和纬度处旋转街景中的图像。角度无关紧要....这是代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Street View service</title>
<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
//this for loop is for rotating the image.
for(var i=0;i<15;i++) {
function initialize() {
var fenway = new google.maps.LatLng(42.345573,-71.098326);
var mapOptions = {
center: fenway,
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(
document.getElementById('map-canvas'), mapOptions);
var panoramaOptions = {
position: fenway,
pov: {
heading: 0+10*i,
pitch: 10
}
};
var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions);
map.setStreetView(panorama);
//此循环用于等待图像加载..我知道这效率不高,但只是想给图像加载足够的时间 for(var k=0;k<10000;k++){}
}
google.maps.event.addDomListener(window, 'load', 初始化); }
</script>
<div id="pano" style="position:absolute; left:10px; top: 8px; width: 1300px; height: 670px;"></div>
<div id="map-canvas" style="left:1100px; top: 450px;width: 200px; height: 200px"></div>
当我执行整个代码时..只有特定角度的图像才会出现..它不会旋转。
你能帮我么?:)