jetlag2d
    Preparing search index...

    Class AccelerometerDevice

    AccelerometerDevice provides access to device orientation and motion events from a web browser. The support for orientation and motion varies among browsers, but it seems that the "acceleration including gravity" component of DeviceMotion events gives us roughly the data we need.

    DeviceMotion events happen whenever they want to happen, but JavaScript won't let them happen in the middle of a render. When the events happen, we copy the event data, and then during render operations, other code can poll this device for the most recent data.

    Index
    accel: b2Vec2 = ...

    The most recent accelerometer reading

    • get tiltSupported(): boolean

      Is tilt supported on this device? This is false on a device with no accelerometer, and also during the first moments of a game on a phone, before the first reading arrives.

      Returns boolean