https://github.com/ryohidaka/compass-heading-js
Converts device orientation to compass heading.
https://github.com/ryohidaka/compass-heading-js
compass geolocation heading orientation typescript
Last synced: 5 months ago
JSON representation
Converts device orientation to compass heading.
- Host: GitHub
- URL: https://github.com/ryohidaka/compass-heading-js
- Owner: ryohidaka
- License: mit
- Created: 2024-01-13T02:53:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-01T22:21:54.000Z (10 months ago)
- Last Synced: 2025-04-19T08:49:20.120Z (6 months ago)
- Topics: compass, geolocation, heading, orientation, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/compass-heading-js
- Size: 980 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# compass-heading-js
[](https://badge.fury.io/js/compass-heading-js)
[](https://opensource.org/licenses/MIT)## Overview
Converts device orientation to compass heading.
## Installation
You can install this library using npm:
```shell
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
```typescript
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](LICENSE) file for details.