小程序開發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小程序。
第二部分:如何開通一個小商店