Skip to main content
Version: Next

Taro.onGyroscopeChange(callback)

Listens on the gyroscope data change event. The frequency is based on the Taro.startGyroscope() interval parameter. You can use Taro.stopGyroscope() to stop listening.

Reference

Type

(callback: Callback) => void

Parameters

Callback

The callback function for the gyroscope data change event.

(result: CallbackResult) => void
PropertyType
resultCallbackResult

CallbackResult

PropertyTypeDescription
xnumberX-axis angular velocity
ynumberY-axis angular velocity
znumberZ-axis angular velocity

API Support

APIWeChat Mini-ProgramH5React Native
Taro.onGyroscopeChange✔️✔️