非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

DeviceMotionEvent 构造函数创建新 DeviceMotionEvent .

句法

var deviceMotionEvent = new DeviceMotionEvent(type[, options])
					

参数

type
Must be "devicemotion" .
选项 可选
Options are as follows:
  • acceleration : An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s 2 .
  • accelerationIncludingGravity : An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s 2 .
  • rotationRate : An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. Rotation rate is express in degrees per seconds.
  • interval : A number representing the interval of time, in milliseconds, at which data is obtained from the device.

规范

Not part of any specifications.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
DeviceMotionEvent() 构造函数 非标 Chrome 59 Edge ≤79 Firefox ? IE No Opera ? Safari ? WebView Android 59 Chrome Android 59 Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android 7.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

元数据

  • 最后修改: