# wx.onDeviceMotionChange(function callback)
Start from base library version 2.3.0. Please remaining backward compatible.
Listens on the device orientation change event. The frequency is based on the wx.startDeviceMotionListening() interval parameter. You can use wx.stopDeviceMotionListening() stop listening.
# Parameters
# function callback
The callback function for the device orientation change event.
# Parameters
# Object res
Property | Type | Description |
---|---|---|
alpha | number | When the phone coordinate X/Y and the earth coordinate X/Y coincide, the angle of rotation around the Z axis is alpha. The range is [0, 2*PI). It is positive when the phone rotates counterclockwise. |
beta | number | When the phone coordinate Y/Z and the earth coordinate Y/Z coincide, the angle of rotation around the X axis is beta. The range is [-1*PI, PI). It is positive when the phone rotates with its top toward the earth surface or the user. |
gamma | number | When the phone coordinate X/Z and the earth coordinate X/Z coincide, the angle of rotation around the Y axis is gamma. The range is [-1*PI/2, PI/2). It is positive when the phone rotates with its right side toward the earth surface. |