DeviceMotionEvent.acceleration

  • Revision slug: Web/API/DeviceMotionEvent.acceleration
  • Revision title: DeviceMotionEvent.acceleration
  • Revision id: 400125
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 53 words addedMoved From DOM/DeviceMotionEvent.acceleration to Web/API/DeviceMotionEvent.acceleration

Revision Content

{{ DomRef() }}

Summary

Returns the amount of acceleration recorded by the device, in meters per second squared.

Note: If the hardware doesn't know how to remove gravity from the acceleration data, this value may not be present in the {{ domxref("DeviceMotionEvent") }}. In this situation, you'll need to use {{ domxref("DeviceMotionEvent.accelerationIncludingGravity") }} instead.

Syntax

var acceleration = motionEvent.acceleration;

Example

Specification

See also

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Returns the amount of acceleration recorded by the device, in meters per second squared.</p>
<div class="note"><strong>Note:</strong> If the hardware doesn't know how to remove gravity from the acceleration data, this value may not be present in the {{ domxref("DeviceMotionEvent") }}. In this situation, you'll need to use {{ domxref("DeviceMotionEvent.accelerationIncludingGravity") }} instead.</div>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval"><em>var acceleration</em> = motionEvent.acceleration;
</pre>
<h3 id="Example" name="Example">Example</h3>
<h3 id="Specification" name="Specification">Specification</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/orientation-event/" title="http://www.w3.org/TR/orientation-event/">DeviceOrientation Event Specification</a></li>
</ul>
<h3 id="See_also">See also</h3>
<ul> <li>{{ domxref("DeviceMotionEvent") }}</li> <li><a href="/en/Detecting_device_orientation" title="Detecting device orientation">Detecting device orientation</a></li> <li>{{ domxref("window.ondevicemotion") }}</li>
</ul>
Revert to this revision