Hacker News new | ask | show | jobs
by willscott 5607 days ago
The accelerometer interaction hooks into javascript via browser events.

Here's the basic usage for chrome: (for firefox the event is MozOrientation, and values are radians rather than degrees)

  window.addEventListener('deviceorientation', function(evt) {
    var x = evt.gamma, y = evt.beta;
  }, false);