Is there access to the iPhone accelerometer using Javascript?

前端 未结 5 383
心在旅途
心在旅途 2021-01-01 23:21

I\'m starting to try and do some web based game programming for my iPhone, and other web enabled phones that my friends have, and was having a hard time finding information

5条回答
  •  -上瘾入骨i
    2021-01-01 23:35

    iOS 4.2 provides Accelerometer & Gyroscope support through the DeviceOrientation API.

    • DeviceMotionEvent class reference

    • DeviceOrientationEvent class reference

    Here a working javascript snippet.

提交回复
热议问题