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 |
浏览器兼容性
BCD tables only load in the browser