Standalone device orientation + motion detection, normalization and conversion library
This is a fork published to npm. See the original for support etc. Warning: Full-Tilt has a non-commercial license, so cannot be used in commercial projects.
Full Tilt provides developers with three complementary device orientation sensor output representations – screen-adjusted Quaternions, Rotation Matrixes and Euler Angles – that can be used to create 2D or 3D experiences in web browsers that work consistently across all mobile web platforms and in all screen orientations.
This library also provides all the functions necessary to convert between different device orientation types. Orientation angle conversion is possible via this API from/to Device Orientation and Motion API-derived Euler Angles, Rotation Matrices and/or Quaternions (i.e. from raw sensor inputs that supply intrinsic Tait-Bryan angles of type Z-X'-Y').
This library is available on Bower as fulltilt:
$> bower install fulltilt
You will also need a Promise polyfill for older browsers.
$> bower install es6-promise
If the requested sensor is supported on the current device then this Promise object will resolve to
FULLTILT.DeviceMotion as appropriate. This returned object can then be used to interact with the device's sensors via the FULLTILT APIs.
If the requested sensor is not supported on the current device then this Promise object will reject with a simple error message string. In such circumstances it is recommended to provide manual fallback controls so users can still interact with your web page appropriately.
Here is a quick example of how to use Full Tilt: