deviceorientation
DeviceOrientation is a web API that reports the physical orientation and motion of a device by emitting DeviceOrientationEvent objects. These events carry rotation data that can be used to drive interactive features such as compass apps, 3D viewers, or tilt-based controls in games. The data reflects how the device is rotated in space relative to the viewer.
Each event includes alpha, beta, gamma, and sometimes an absolute flag. Alpha represents rotation around the
To use it, register an event listener for 'deviceorientation' on a global object, e.g., window, and read
Support varies by platform and browser; some environments restrict access. The API is often used alongside