wx.onGyroscopeChange(function callback)

支持版本 >= 2.3.0

监听陀螺仪数据变化事件。频率根据 wx.startGyroscope() 的 interval 参数。可以使用 wx.stopGyroscope() 停止监听。

参数

function callback

陀螺仪数据变化事件的回调函数

参数

Object res

属性 类型 说明 支持版本
res Object

res 的结构

属性 类型 说明 支持版本
x number x 轴的角速度
y number y 轴的角速度
z number z 轴的角速度

原文: https://developers.weixin.qq.com/minigame/dev/api/device/gyroscope/wx.onGyroscopeChange.html