/*定义控件*/ var krpano = document.getElementById("krpanoSWFObject"); /*获取变量*/ var fov = Number(krpano.get("view.fov")); var hlookat = Number(krpano.get("view.hlookat")); var vlookat = Number(krpano.get("view.vlookat")); /*放大*/ fov -= 10.0; krpano.set("view.fov", fov); /*缩小*/ fov += 10.0; krpano.set("view.fov", fov); /*左旋转*/ hlookat += 10.0; krpano.set("view.hlookat", hlookat); /*右旋转*/ hlookat -= 10.0; krpano.set("view.hlookat", hlookat); /*上倾斜*/ vlookat -= 10.0; krpano.set("view.vlookat", vlookat); /*下倾斜*/ vlookat += 10.0; krpano.set("view.vlookat", vlookat); /*自动旋转*/ krpano.set("autorotate.enabled", true); /*VR模式*/ krpano.call("WebVR.enterVR();"); /*全屏*/ krpano.set("fullscreen", true); /*停止旋转*/ krpano.set("autorotate.enabled", false); 以上的方法如放大缩小是不带动画的,有卡顿的感觉。下面的方法利用setTimeout方法实现平滑过渡。 /*放大*/ krpano.set("fov_moveforce",-1); setTimeout("krpano.set(‘fov_moveforce‘,0)",200); /*缩小*/ krpano.set("fov_moveforce",1); setTimeout("krpano.set(‘fov_moveforce‘,0)",200); /*左旋转*/ krpano.set("hlookat_moveforce",-1); setTimeout("krpano.set(‘hlookat_moveforce‘,0)",200); /*右旋转*/ krpano.set("hlookat_moveforce",1); setTimeout("krpano.set(‘hlookat_moveforce‘,0)",200); /*上倾斜*/ krpano.set("vlookat_moveforce",-1); setTimeout("krpano.set(‘vlookat_moveforce‘,0)",200); /*下倾斜*/ krpano.set("vlookat_moveforce",1); setTimeout("krpano.set(‘vlookat_moveforce‘,0)",200);
原文地址:https://www.cnblogs.com/lijiapeng/p/10511212.html
时间: 2024-10-09 00:41:14