update
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 110 B |
@@ -0,0 +1,18 @@
|
||||
/* krpanoJS 1.0.8.14 gyro plugin (build 2012-02-20)
|
||||
for devices with Gyro sensor (iPhone4 and iPad2 with iOS4.2+)
|
||||
by Aldo Hoeben / fieldOfView.com
|
||||
contributions by
|
||||
Sjeiti / ronvalstar.nl
|
||||
Klaus / krpano.com
|
||||
|
||||
http://fieldofview.github.com/krpano_fovplugins/gyro/plugin.html
|
||||
This software can be used free of charge and the source code is available under a Creative Commons Attribution license:
|
||||
http://creativecommons.org/licenses/by/3.0/
|
||||
*/
|
||||
var krpanoplugin=function(){function w(){if(t===undefined)g=true;else if(t&&!g){window.addEventListener("deviceorientation",D,true);c.control.layer.addEventListener("touchstart",E,true);c.control.layer.addEventListener("touchend",x,true);c.control.layer.addEventListener("touchcancel",x,true);g=true;z=-(n?top.orientation:window.orientation);p=k=h=0}else g=false}function y(){if(t&&g){window.removeEventListener("deviceorientation",D);c.control.layer.removeEventListener("touchstart",E);c.control.layer.removeEventListener("touchend",
|
||||
x);c.control.layer.removeEventListener("touchcancel",x)}g=false}function G(){g?y():w()}function A(){t=true;window.removeEventListener("deviceorientation",A);if(g){g=false;w()}}function E(){B=true}function x(){B=false}function D(f){if(!B&&g){var u,d=Object({yaw:f.alpha*q,pitch:f.beta*q,roll:f.gamma*q}),e,a,b;e=Math.cos(d.yaw);a=Math.sin(d.yaw);b=Math.cos(d.pitch);var i=Math.sin(d.pitch),l=Math.cos(d.roll);d=Math.sin(d.roll);matrix=Array(a*d-e*i*l,-e*b,e*i*d+a*l,b*l,-i,-b*d,a*i*l+e*d,a*b,-a*i*d+e*l);
|
||||
if(matrix[3]>0.9999){e=Math.atan2(matrix[2],matrix[8]);b=Math.PI/2;a=0}else if(matrix[3]<-0.9999){e=Math.atan2(matrix[2],matrix[8]);b=-Math.PI/2;a=0}else{e=Math.atan2(-matrix[6],matrix[0]);a=Math.atan2(-matrix[5],matrix[4]);b=Math.asin(matrix[3])}u=Object({yaw:e,pitch:b,roll:a});e=r(u.yaw/q);a=u.pitch/q;b=e;i=c.view.hlookat;l=c.view.vlookat;d=c.view.camroll;var H=i-k,F=l-p;if(C)o=r(180+Number(n?top.orientation:window.orientation)-u.roll/q);if(Math.abs(a)>70){b=f.alpha;switch(n?top.orientation:window.orientation){case 0:if(a>
|
||||
0)b+=180;break;case 90:b+=90;break;case -90:b+=-90;break;case 180:if(a<0)b+=180;break}b=r(b);if(Math.abs(b-e)>180)b+=b<e?360:-360;f=Math.min(1,(Math.abs(a)-70)/10);e=e*(1-f)+b*f;o*=1-f}z+=H;h+=F;if(Math.abs(a+h)>90)h=a+h>0?90-a:-90-a;k=r(-e-180+z);p=Math.max(Math.min(a+h,90),-90);if(Math.abs(k-i)>180)i+=k>i?360:-360;k=(1-m)*k+m*i;p=(1-m)*p+m*l;if(Math.abs(o-d)>180)d+=o>d?360:-360;o=(1-m)*o+m*d;c.view.hlookat=r(k);c.view.vlookat=p;c.view.camroll=r(o);if(h!=0&&v>0)if(F==0)if(v==1)s=h=0;else{s=1-(1-
|
||||
s)*c.control.touchfriction;h*=1-Math.pow(v,2)*s;if(Math.abs(h)<0.1)s=h=0}else s=0}}function r(f){f%=360;return f<=180?f:f-360}var c=null,j=null,t,g=false,v=0,C=false,m=0.5,B=false,z=0,h=0,k=0,p=0,o=0,s=0,q=Math.PI/180,n=false;this.registerplugin=function(f,u,d){c=f;j=d;if(c.version<"1.0.8.14"||c.build<"2011-03-30")c.trace(3,"gyro plugin - too old krpano version (min. 1.0.8.14)");else{n=c._have_top_access;if(n===undefined){n=false;try{if(top&&top.document)n=true}catch(e){}}window.DeviceOrientationEvent&&
|
||||
window.addEventListener("deviceorientation",A);j.registerattribute("available",false,function(){},function(){return t});j.registerattribute("enabled",true,function(a){String("yesontrue1").indexOf(String(a).toLowerCase())>=0?w():y()},function(){return g});j.registerattribute("velastic",0,function(a){v=Math.max(Math.min(Number(a),1),0)},function(){return v});j.registerattribute("camroll",false,function(a){C=String("yesontrue1").indexOf(String(a).toLowerCase())>=0},function(){return C});j.registerattribute("friction",
|
||||
0.5,function(a){m=Math.max(Math.min(Number(a),1),0)},function(){return m});j.enable=w;j.disable=y;j.toggle=G}};this.unloadplugin=function(){window.removeEventListener("deviceorientation",A);y();c=j=null}};
|
||||
|
After Width: | Height: | Size: 584 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 940 B |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 596 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 34 B |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 902 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 326 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 34 B |