DeviceMotionEvent.DeviceMotionEvent()

翻译不完整。 请帮助我们翻译这篇文章!

非标准
该特性是非标准的,请尽量不要在生产环境中使用它!

The DeviceMotionEvent constructor 会创建一个新的 DeviceMotionEvent.

语法

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

参数

type
必须是 "devicemotion".
options可选
可选项如下:
  • acceleration: 一个对象,包含设备在X,Y和Z三个轴线上的加速度。加速度的单位为m/s2.
  • accelerationIncludingGravity: 一个对象,包含设备在X,Y和Z三个轴线上,重力作用下的加速度。加速度的单位为m/s2.
  • rotationRate: 一个对象,包含设备的定向在三个定向轴alpha, beta 和 gamma上的偏移比率。偏移比率的单位是每秒偏移的角度。
  • interval: 时间间隔,单位毫秒,表示设备获取数据的间隔时间。

说明

无特别说明。

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
DeviceMotionEvent() constructor
ExperimentalNon-standard
Chrome Full support 59Edge Full support ≤79Firefox ? IE No support NoOpera ? Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support 7.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.