牛骨文教育服务平台(让学习变的简单)

微信小程序API 重力感应


wx.onAccelerometerChange(CALLBACK)


监听重力感应数据,频率:5次/秒

CALLBACK返回参数:

QQ截图20170208114315.png

示例代码:

wx.onAccelerometerChange(function(res) {
  console.log(res.x)
  console.log(res.y)
  console.log(res.z)
})