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.
Type
(callback: Callback) => void
Parameters
Callback
The callback function for the gyroscope data change event.
(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 | ✔️ | ✔️ |