title: Taro.onGyroscopeChange(callback)

sidebar_label: onGyroscopeChange

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

  1. (callback: Callback) => void

Parameters

Callback

The callback function for the gyroscope data change event.

  1. (result: CallbackResult) => void
Property Type
result CallbackResult

CallbackResult

Property Type Description
x number X-axis angular velocity
y number Y-axis angular velocity
z number Z-axis angular velocity

API Support

API WeChat Mini-Program H5 React Native
Taro.onGyroscopeChange ✔️ ✔️