+ 1
Can i use my phone's accelerometers in JavaScript code?
I am currently writing a JavaScript code for a biljart (pool) game and i was wondering if i could shoot the cue bal using the accelerometers of the phone, have the phone act as it were the cue stick. Does anyone have an idea on how and if this can be done? Thanks for helping me out. I included the unfinished game https://code.sololearn.com/WY734AN3TF0c/?ref=app
1 Answer
+ 3
Hi davy
Yes you can use the gyroscope api
https://developer.mozilla.org/en-US/docs/Web/API/Detecting_device_orientation