May 19, 2021 WeChat Mini Program Development Document
The base library 2.3.0 starts to support, and the lower version needs to be compatible.
Stop listening for changes in the orientation of the device.
Property | Type | The default | Required | Description |
---|---|---|---|---|
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
The base library 2.3.0 starts to support, and the lower version needs to be compatible.
Start listening for changes in the orientation of the device.
Property | Type | The default | Required | Description |
---|---|---|---|---|
interval | string | normal | Whether | The frequency with which the callback function performs to listen for changes in the orientation of the device |
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
The legal value of object.interval
Value | Description | The lowest version |
---|---|---|
game | Callback frequency for updating games, around 20ms/time | |
Ui | Callback frequency for updating the UI, around 60ms/time | |
normal | Normal callback frequency, around 200ms/time |
The base library 2.3.0 starts to support, and the lower version needs to be compatible.
Listen for device orientation change events. T he frequency is based on the interval parameter of wx.startDeviceMotionListening(). You can use wx.stopDeviceMotionListening() to stop listening.
The callback function for the device orientation change event
Property | Type | Description |
---|---|---|
alpha | number | When the phone coordinates X/Y and Earth X/Y meet, the angle that rotates around the Z axis is alpha, with a range value of .0, 2 x PI. Turn counterclockwise to positive. |
Beta | number | When the phone coordinates Y/Z and Earth Y/Z meet, the angle that rotates around the X axis is beta. T he range value is -1-PI, PI. T he top rotates positively toward the earth's surface. It is also possible to move towards the user as positive. |
gamma | number | When the phone X/Z and Earth X/Z meet, the angle that rotates around the Y axis is gamma. T he range value is -1 x PI/2, PI/2). The right side turns positive towards the earth's surface. |
Base Library 2.9.3 starts to support, and low versions need to be compatible.
Cancel all event listening events with an empty parameter.
The callback function for the device orientation change event
Base Library 2.9.3 starts to support, and low versions need to be compatible.
Cancel all event listening events with an empty parameter.
The callback function for the device orientation change event
Base Library 2.9.3 starts to support, and low versions need to be compatible.
Cancel all event listening events with an empty parameter.
The callback function for the device orientation change event