# wx.onDeviceMotionChange(function callback)
Start from base library version 2.3.0. Please remaining backward compatible.
with Promise style call: Not supported
Mini Program plugin: Not supported
Listen for device direction change events. Frequency basis wx.startDeviceMotionListening() of interval Parameters. Can be used wx.stopDeviceMotionListening() Stop listening.
# parameter
# function callback
Callback function for device orientation change event
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
alpha | number | when Cell phone coordinates X/And and Earth X/And When overlapped, around. With |
The angle at which the axis rotates is Alpha, with a range value of [0, 2*PI). Turning counterclockwise is positive. | ||
beta | number | When the phone coordinates And/With |
And the Earth And/With When overlapped, around. X The angle at which the axis rotates is beta。 Range values are [-1PI, PI) The top is turned positive towards the Earth's surface. It is also possible to be positive towards the user. | | gamma | number | When the phone X/With And the Earth X/With When overlapped, around. And The angle at which the axis rotates is gamma。 Range values are [-1PI/2, PI/2)The right side turns positive toward the Earth's surface. |