Skip to main content

bn.onDeviceMotionChange

onDeviceMotionChange(cb): void

description Listen for device direction change events. Frequency basis bn.startDeviceMotionListening() of interval Parameters. Can be used bn.stopDeviceMotionListening() Stop listening.

example

 bn.onDeviceMotionChange(callback)

Parameters

NameType
cbOnDeviceMotionChangeCallback

Returns

void


OnDeviceMotionChangeCallback

Ƭ OnDeviceMotionChangeCallback: (result: OnDeviceMotionChangeCallbackResult) => void

Type declaration

▸ (result): void

Callback function for device orientation change event

Parameters

NameType
resultOnDeviceMotionChangeCallbackResult

Returns

void


Interface: OnDeviceMotionChangeCallbackResult

NameTypeDescription
alphanumberWhen Cell phone coordinates X 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.
betanumberWhen the phone coordinate Y/Z coincides with the earth Y/Z, 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.
gammanumberWhen the X/Z of the mobile phone coincides with the X/Z of the earth, the included angle of rotation around the Y axis is gamma. Range values are [-1*PI/2, PI/2). Turning right towards the Earth's surface is positive.