小程序开发wx.onAccelerometerChange(CALLBACK),监听加速度数据频率:5次/秒
2017-12-11
导读:监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer 停止监听。 CALLBACK返回参数: 参数 类型 说明 x Number X 轴 y Number Y 轴 z Number Z 轴 示例代码: wx.o...
监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 wx.stopAccelerometer
停止监听。
CALLBACK返回参数:
参数 | 类型 | 说明 |
---|---|---|
x | Number | X 轴 |
y | Number | Y 轴 |
z | Number | Z 轴 |
示例代码:
wx.onAccelerometerChange(function(res) {
console.log(res.x)
console.log(res.y)
console.log(res.z)
})
更多微信小程序开发教程,关注hi小程序。
第二部分:如何开通一个小商店