Converts device orientation to compass heading.
You can install this library using npm:
npm install compass-heading-js
key | descriptiion |
---|---|
alpha | The device's compass heading |
beta | the device's tilt front-to-back |
gamma | the device's tilt left-to-right |
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
This project is licensed under the MIT License - see the LICENSE file for details.