Gyroscope: Gyroscope() コンストラクター

Limited availability

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

Gyroscope() コンストラクターは、デバイスの 3 軸それぞれの角速度の計測値を提供する新しい Gyroscope オブジェクトを生成します。

構文

js
new Gyroscope()
new Gyroscope(options)

引数

options 省略可

以下のオプションがあります。

frequency

1 秒あたり取得するべきサンプルの数であり、1 秒あたり何回 reading イベントが呼ばれるかになります。整数または小数を使用でき、小数は 1 秒に 1 回未満の頻度に用います。実際の取得の頻度はデバイスハードウェアに依存し、指定より少なくなる可能性があります。

referenceFrame

'device' または 'screen' です。デフォルトは 'device' です。

例外

SecurityError DOMException

この機能の使用が 権限ポリシー によりブロックされたとき投げられます。

仕様書

Specification
Gyroscope
# dom-gyroscope-gyroscope

ブラウザーの互換性

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
Gyroscope() constructor

Legend

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

Full support
Full support
No support
No support

関連情報