DeviceMotionEvent.rotationRate

  • Revision slug: Web/API/DeviceMotionEvent.rotationRate
  • Revision title: DeviceMotionEvent.rotationRate
  • Revision id: 413751
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ DomRef() }}

Summary

Returns the rate at which the device is rotating around each of its axes in degrees per second.

Note: If the hardware isn't capable of providing this information, this property returns null.

Syntax

var rates = instanceOfDeviceMotionEvent.rotationRate;

Value

The rotationRates property is a read only object describing the rotation rates of the device around each of its axes:

alpha
The rate at which the device is rotating about its Z axis; that is, being twisted about a line perpendicular to the screen.
beta
The rate at which the device is rotating about its X axis; that is, front to back.
gamma
The rate at which the device is rotating about its Y axis; that is, side to side.

Specifications

Specification Status Comment
{{SpecName('Device Orientation')}} {{Spec2('Device Orientation')}} Initial specification.

Browser Compatibility

{{ page("/en-US/docs/Web/API/DeviceMotionEvent","Browser_compatibility") }}

See also

Revision Source

<p>{{ DomRef() }}</p>
<h2 id="Summary" name="Summary">Summary</h2>
<p>Returns the rate at which the device is rotating around each of its axes in degrees per second.</p>
<div class="note">
  <strong>Note</strong>: If the hardware isn't capable of providing this information, this property returns <code>null</code>.</div>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="eval">
var rates = <em>instanceOfDeviceMotionEvent</em>.rotationRate;
</pre>
<h2>Value</h2>
<p>The <code>rotationRates</code> property is a read only object describing the rotation rates of the device around each of its axes:</p>
<dl>
  <dt>
    <code>alpha</code></dt>
  <dd>
    The rate at which the device is rotating about its Z axis; that is, being twisted about a line perpendicular to the screen.</dd>
  <dt>
    <code>beta</code></dt>
  <dd>
    The rate at which the device is rotating about its X axis; that is, front to back.</dd>
  <dt>
    <code>gamma</code></dt>
  <dd>
    The rate at which the device is rotating about its Y axis; that is, side to side.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('Device Orientation')}}</td>
      <td>{{Spec2('Device Orientation')}}</td>
      <td>Initial specification.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_Compatibility">Browser Compatibility</h2>
<p>{{ page("/en-US/docs/Web/API/DeviceMotionEvent","Browser_compatibility") }}</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ domxref("DeviceMotionEvent") }}</li>
  <li>{{ event("devicemotion") }}</li>
  <li>{{ domxref("window.ondevicemotion") }}</li>
  <li>{{ event("deviceorientation") }}</li>
  <li>{{ domxref("DeviceOrientationEvent") }}</li>
  <li><a href="/en-US/docs/WebAPI/Detecting_device_orientation" title="/en-US/docs/WebAPI/Detecting_device_orientation">Detecting device orientation</a></li>
  <li><a href="https://developer.mozilla.org/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a></li>
</ul>
Revert to this revision