krpano JS动态切换旋转角
/*定义控件*/ var krpano = document.getElementById("krpanoSWFObject"); /*旋转到指定视角*/ function openChoose() { /*获取旋转角变量,并去小数点*/ var hlookat = Number(krpano.get("view.hlookat")).toFixed(0); var quyu = 0 console.log(hlookat) /*判断旋转圈数*/ if(hlookat > 360){ quyu = Math.floor(hlookat / 360) } if(hlookat < -360){ quyu = Math.floor(hlookat / 360) } hlookat = hlookat - 360 * quyu var t = setInterval(function() { if(hlookat == 100) { clearInterval(t); } else if(hlookat<100){ hlookat++; krpano.set("view.hlookat", hlookat); }else if(hlookat>100){ hlookat--; krpano.set("view.hlookat", hlookat); } }, 10); }