accelerationIncludingGravity属性返回设备的加速度的记录,单位为米每秒平方(m / s2)。与已移除重力加速度的DeviceMotionEvent.acceleration
不同,此值是由用户引起的设备的加速度和由重力加速度的总和。
此值通常不如DeviceMotionEvent.acceleration
实用,但是在部分不能自动从加速度数据中移除重力加速度的设备(例如没有陀螺仪的设备),是唯一可用值。
语法
var acceleration = instanceOfDeviceMotionEvent.accelerationIncludingGravity;
值
accelerationIncludingGravity
是一个包括三轴(x、y、z)加速度信息的对象,每个轴都有自己的属性:
x
- 表示x轴(西到东)上的加速度
y
- 表示y轴(南到北)上的加速度
z
- 表示z轴(下到上)上的加速度
说明
Specification | Status | Comment |
---|---|---|
DeviceOrientation Event Specification | Editor's Draft | Initial specification. |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 6 (6) | ? | ? | ? |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 6.0 (6) | 未实现 | 未实现 | 4.2 |