iphone - ios 如何检测摇左边还是右边?
PHP中文网
PHP中文网 2017-04-17 12:03:40
0
1
699

我向左或者右边摇动的时候如何检测到他是要到哪个方向呢?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
刘奇

deviceorientation You can get the x, y, z axes of the device running in space
devicemotion You can get the gravitational acceleration triggered by the device

The next step is calculation

You can do a data monitoring to obtain the values ​​​​of the two APIs, and then the tester shakes it repeatedly to find the pattern.

General idea: acceleration peak + x or y axis peak?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template