Accessing the Accelerometer and Gyroscope in JavaScript

Now that you can access motion sensors in both Google Chrome and mobile browsers, I decided to demo a couple of sample application which hook into the accelerometer and gyroscope:

If you want to see these applications in action and/or check out the code, the links are below:

Note that the compass application only works on devices with gyroscopes (no laptops that I know if), and requires iOS 5 or newer.

4 Responses to Accessing the Accelerometer and Gyroscope in JavaScript

  1. Robert says:

    Also works on Android.
    Runs smooth on SGS with ICS 4.0.3 and Chrome beta.

  2. Macbook Pros have gyroscopes.

    They’re used to stop the drives in cases of sudden acceleration (drops, plane turbulence, etc).

    http://www.osxbook.com/book/bonus/chapter10/ams/

    Some iOS dev’s use libraries to simulate tilt for the iOS simulator using the macbook gryo.

  3. Doug Turner says:

    Where is the Mozilla and Opera support? Both support device motion and orientation.

  4. Pingback: Accessing the Accelerometer and Gyroscope in JavaScript | HTML5 Game Development