Contents

DeviceMotionEvent

An instance of DeviceMotionEvent is created when significant change in motion occurs. The event object encapsulates the measurements of the interval, rotation rate, and acceleration of a device.

Declaration

interface DeviceMotionEvent

Overview

The accelerometer measures the sum of two acceleration vectors: gravity and user acceleration. User acceleration is the acceleration that the user imparts to the device. Because the system is able to track the device’s attitude using both the gyroscope and the accelerometer, it can differentiate between gravity and user acceleration.

You register for these types of events using the window’s addEventListener method by passing devicemotion as the event type.

Topics

Creating Motion Events

Getting Motion Event Properties