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

LinearAccelerationSensor() コンストラクターは、デバイスの 3 軸それぞれにかかっている加速度の測定値を、重力の影響を除いて提供する新しい LinearAccelerationSensor オブジェクトを生成します。

構文

js
new LinearAccelerationSensor()
new LinearAccelerationSensor(options)

引数

options 省略可

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

frequency

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

referenceFrame

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

例外

SecurityError DOMException

この機能の使用が Permissions Policy によりブロックされました。

仕様書

Specification
Accelerometer
# dom-linearaccelerationsensor-linearaccelerationsensor

ブラウザーの互換性

BCD tables only load in the browser

関連情報