Gyroscope:x 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
值
一个 Number
。
示例
陀螺仪通常在 reading
事件回调中读取。在下面的例子中,这种情况每秒发生 60 次。
js
let gyroscope = new Gyroscope({ frequency: 60 });
gyroscope.addEventListener("reading", (e) => {
console.log(`沿着 X 轴的角速度 ${gyroscope.x}`);
console.log(`沿着 Y 轴的角速度 ${gyroscope.y}`);
console.log(`沿着 Z 轴的角速度 ${gyroscope.z}`);
});
gyroscope.start();
规范
Specification |
---|
Gyroscope # gyroscope-x |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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.