陀螺仪:z 属性
值
一个 Number
。
示例
通常在 reading
事件回调中读取陀螺仪。在下面的示例中,每秒发生 60 次。
js
let gyroscope = new Gyroscope({ frequency: 60 });
gyroscope.addEventListener("reading", (e) => {
console.log(`Angular velocity along the X-axis ${gyroscope.x}`);
console.log(`Angular velocity along the Y-axis ${gyroscope.y}`);
console.log(`Angular velocity along the Z-axis ${gyroscope.z}`);
});
gyroscope.start();
规范
规范 |
---|
陀螺仪 # gyroscope-z |
浏览器兼容性
BCD 表格仅在启用 JavaScript 的浏览器中加载。