mirror of
https://github.com/acamarata/moon-cycle.git
synced 2026-06-30 18:54:29 +00:00
No description
| .github | ||
| mm-256-75 | ||
| mm-256-85 | ||
| mm-512-75 | ||
| mm-512-85 | ||
| my-256-75 | ||
| my-256-85 | ||
| my-512-75 | ||
| my-512-85 | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .npmrc | ||
| .nvmrc | ||
| CHANGELOG.md | ||
| eslint.config.mjs | ||
| LICENSE | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| test-cjs.cjs | ||
| test.mjs | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| typedoc.json | ||
moon-cycle
Maps any JavaScript Date to the correct NASA moon phase image filename. Two algorithms: synodic-cycle mapping (708 images) and calendar-year mapping (8,760 images).
Not published to npm. The image dataset (~438 MB of hourly WebP photos from NASA's Scientific Visualization Studio) lives in this repository. Use CDN or clone.
Install
# Clone to get code and images together
git clone https://github.com/acamarata/moon-cycle.git
# Or add the code-only package via git
pnpm add github:acamarata/moon-cycle
Quick Start
import { cycleMonth, cdnUrl } from 'moon-cycle';
const filename = cycleMonth(); // e.g. "354.webp"
const url = cdnUrl(filename, 'mm', 256, 75);
// => 'https://cdn.jsdelivr.net/gh/acamarata/moon-cycle@main/mm-256-75/354.webp'
CommonJS:
const { cycleMonth, cdnUrl } = require('moon-cycle');
Documentation
Full reference: GitHub Wiki
Related
- nrel-spa: Pure JS NREL Solar Position Algorithm
- pray-calc: Islamic prayer times
- moon-sighting: Lunar crescent visibility
Acknowledgments
Moon phase imagery from NASA's Scientific Visualization Studio:
Ernie Wright (2023). Moon Phase and Libration, 2023 [Data set]. NASA Scientific Visualization Studio. https://svs.gsfc.nasa.gov/5187
Images are in the public domain per NASA's media usage guidelines.
License
MIT. See LICENSE for the full text.