Skip to main content

GyroscopeInput

The GyroscopeInput class provides methods to capture and manage gyroscope input from the device.

start()

Starts capturing gyroscope input.

Example:

Input.gyroscope.start();

stop()

Stops capturing gyroscope input.

Example:

Input.gyroscope.stop();

isSupported(): boolean

Checks if the device supports gyroscope input.

Example:

if (Input.gyroscope.isSupported()) {
console.log('Gyroscope is supported');
}

orientation(): DeviceOrientation

Returns the current orientation of the gyroscope, including alpha, beta, and gamma angles.

Example:

const orientation = Input.gyroscope.orientation();
console.log(orientation.alpha, orientation.beta, orientation.gamma);