加速度センサーの値を表示するサンプル(MozOrientation)

メモ

Gecko 1.9.2 で導入
Firefox 3.6 と Fennec 1.0 に適用されます

window.onmozorientation - MDC
PCを上昇させなければzの値は1になります。重力の弱いところや無重力空間であればzの値は0になるようです

ASCII.jp:加速度センサーで操縦する地図サイトを作ろう|古籏一浩のJavaScriptラボ

まじで!? ってたしかに Mozilla Developer Center に書いてあった。

The X axis represents the amount of right-to-left tilt. This value is 0 if the device is level along the X axis, and approaches 1 as the device is tilted toward the left, and -1 as the device is tilted toward the right.

The Y axis represents the amount of front-to-back tilt. The value is 0 if the device is level along the Y axis, and approaches 1 as you tilt the device backward (away from you) and -1 as you tilt the device frontward (toward you).

The Z axis represents acceleration vertically. The value is 1 when the device is undergoing standard Earth gravity (9.8m/sec2) but not moving. Moving the device upward causes the value to go down. The value is 0 if the device is in free fall (weightless or falling as a result of a drop).

In weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated.

Detecting device orientation - MDC

Ref.

-window.onmozorientation - MDC
-Detecting device orientation - MDC
-Pages tagged with "Orientation" - MDC
-ASCII.jp:加速度センサーで操縦する地図サイトを作ろう|古籏一浩のJavaScriptラボ