Not sure about current browser support, but you could use accelerometer: How to access accelerometer/gyroscope data from Javascript?
Here's a demo too: http://www.albertosarullo.com/demos/accelerometer/
Please also note that auto screen orientation on your device may cause unexpected behaviour.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.