DeviceMotionEvent

We'll use acceleration and accelerationIncludingGravity give the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2.

		
window.addEventListener('devicemotion', function(event) {
    const x = event.accelerationIncludingGravity.x;
    const y = event.accelerationIncludingGravity.y;
    const z = event.accelerationIncludingGravity.z;
			...
});