Accelerometer Class

The accelerometer (https://w3c.github.io/accelerometer/#accelerometer-interface): the acceleration of the device along its axes, including the gravity, in m/s² rounded to 0.1 m/s². It reads the DeviceSensorType.Accelerometer sensor of the device, and needs the accelerometer permission and permissions policy feature.

public class Accelerometer : Sensor
Inheritance
Sensor Accelerometer

Constructors

NameDescription
Accelerometer(AccelerometerSensorOptions?)Creates an accelerometer. Throws a SecurityError DomException when the document is not allowed to use the accelerometer feature.

Accelerometer(AccelerometerSensorOptions?)

MotionSensors.cs

Creates an accelerometer. Throws a SecurityError DomException when the document is not allowed to use the accelerometer feature.

public Accelerometer(AccelerometerSensorOptions? options = null)

Properties

NameDescription
XGets the acceleration along the X axis, or null.
YGets the acceleration along the Y axis, or null.
ZGets the acceleration along the Z axis, or null.

Gets the acceleration along the X axis, or null.

public double? X { get; }

Gets the acceleration along the Y axis, or null.

public double? Y { get; }

Gets the acceleration along the Z axis, or null.

public double? Z { get; }