Gyroscope: y プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Gyroscope インターフェイスの読み取り専用プロパティ y は、デバイスの y 軸方向の角速度を表す数値を返します。

Number です。

ジャイロスコープは、通常 reading イベントコールバックで読み取られます。以下の例では、これを 1 秒に 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-y

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
y

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support