Gyroscope:Gyroscope() 构造函数
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Gyroscope() 构造函数创建一个新的 Gyroscope 对象,它在每次读取时提供设备沿所有三个轴的角速度。
语法
js
new Gyroscope()
new Gyroscope(options)
参数
options可选-
选项如下:
frequency可选-
每秒采样所需的次数,即每秒调用
reading事件的次数。可使用整数或者小数,小数用于小于一秒的频率。实际读取频率取决于设备硬件,因此可能小于所请求的。 referenceFrame可选-
'device'或'screen',默认值是'device'。
异常
SecurityErrorDOMException-
此特性的使用被权限策略阻止。
规范
| Specification |
|---|
| Gyroscope> # dom-gyroscope-gyroscope> |
浏览器兼容性
Loading…
参见
reading事件