compass-heading-js
v0.1.31
Published
Converts device orientation to compass heading.
Downloads
177
Readme
compass-heading-js
Overview
Converts device orientation to compass heading.
Installation
You can install this library using npm:
npm install compass-heading-js
Props
| key | descriptiion | | ----- | ------------------------------- | | alpha | The device's compass heading | | beta | the device's tilt front-to-back | | gamma | the device's tilt left-to-right |
Usage
import { calculateCompassHeading } from "compass-heading-js";
const alpha = 45;
const beta = 30;
const gamma = 60;
const heading = calculateCompassHeading(alpha, beta, gamma);
console.log(heading);
// Output: 260.76847951640775
License
This project is licensed under the MIT License - see the LICENSE file for details.