DeviceMotionEvent: DeviceMotionEvent() コンストラクター
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。
DeviceMotionEvent() コンストラクターは、新しい DeviceMotionEvent オブジェクトを作成します。
構文
new DeviceMotionEvent(type)
new DeviceMotionEvent(type, options)
引数
type-
文字列で、このイベントの名前が入ります。 大文字小文字の区別があり、ブラウザーは常に
devicemotionに設定します。 options省略可-
オブジェクトで、
Event()に定義されているプロパティに加えて、以下のプロパティを持つことができます。acceleration省略可-
DeviceMotionEventAccelerationオブジェクトで、端末の加速度を X、Y、Z の 3 軸で表します。加速度は m/s² で表されます。指定されなかった場合、オブジェクト内のすべてのプロパティがnullになります。 accelerationIncludingGravity省略可-
DeviceMotionEventAccelerationオブジェクトで、端末の加速度を X、Y、Z の 3 軸と、重力の影響で表します。加速度は m/s² で表されます。指定されなかった場合、オブジェクト内のすべてのプロパティがnullになります。 rotationRate省略可-
DeviceMotionEventRotationRateオブジェクトで、端末の向きの変化率をアルファ、ベータ、ガンマの 3 方向の軸で表します。回転率は秒あたりの角度で表されます。指定されなかった場合、オブジェクト内のすべてのプロパティがnullになります。 interval省略可-
端末からデータを取得する時間間隔をミリ秒単位で表します。既定値では
0です。
返値
新しい DeviceMotionEvent オブジェクトです。
仕様書
| Specification |
|---|
| Device Orientation and Motion> # dom-devicemotionevent-devicemotionevent> |
ブラウザーの互換性
Loading…