关于手机是横向还是纵向和旋转角度
监听旋转: window.addEventListener(‘deviceorientation’, rotateScene, false);
可以通过获取window.orientation的属性值来进行判断:
横向:Math.abs(window.orientation) == 90;
纵向:window.orientation == 0;
旋转角度:var theta = (Math.abs(window.orientation) == 90) ? e.beta : e.gamma;
rotationY = 0 + (15 * (theta / -45));
执行旋转:$scene.css(‘transform’: ‘rotateY(‘ + rotationY + ‘deg)’);