Use this API to listen for device orientation change events. Events are delivered after my.startDeviceMotionListening has been called.
Parameters
Type
Required
Description
Function listener
Yes
Called when the device orientation changes
Listener Callback
Property
Type
Description
alpha
Number
Rotation around the Z-axis when the device’s X/Y axes align with the Earth’s. Range [0, 2π); counterclockwise is positive
beta
Number
Rotation around the X-axis when the device’s Y/Z axes align with the Earth’s. Range [-π, π); positive when the top of the phone faces the Earth’s surface or the user
gamma
Number
Rotation around the Y-axis when the device’s X/Z axes align with the Earth’s. Range [-π/2, π/2); positive when the right side of the phone faces the Earth’s surface