All Projects → ryanseys → lune

ryanseys / lune

Licence: Apache-2.0 license
🌑 Lune.js — Calculate the phases of the moon

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to lune

Planetary-Code-Collection
Thermal, Ice Evolution, and Exosphere Models for Planetary Surfaces
Stars: ✭ 23 (-77.88%)
Mutual labels:  moon
ROMEO
Executables for ROMEO unwrapping for Linux, Windows and Mac OSX
Stars: ✭ 27 (-74.04%)
Mutual labels:  phase
microDL
3D virtual staining with 2D and 2.5D U-Nets
Stars: ✭ 23 (-77.88%)
Mutual labels:  phase
Moon
Moon is a minimal, one column jekyll theme.
Stars: ✭ 2,117 (+1935.58%)
Mutual labels:  moon
Moon
🌙 The minimal & fast library for functional user interfaces
Stars: ✭ 6,058 (+5725%)
Mutual labels:  moon
astral
☀️ Go calculations for the position of the sun and moon.
Stars: ✭ 23 (-77.88%)
Mutual labels:  moon
demoloops
Toolkit for building looping gif "demos" and collection of such
Stars: ✭ 31 (-70.19%)
Mutual labels:  moon
EKAstrologyCalc
Astrology Calculator calculates moon's rise/set times, moon Age, moon phases and Zodiac Sign for location and time
Stars: ✭ 31 (-70.19%)
Mutual labels:  moon
selenoid-container-tests
An automated Java test suite to check browser images quality
Stars: ✭ 12 (-88.46%)
Mutual labels:  moon
PlanetaryImager
Qt capture software for astronomy, mainly planetary shooting
Stars: ✭ 45 (-56.73%)
Mutual labels:  moon
moon-cheeser
Moon Cheeser is an infinite runner where the player plays as a mouse gathering cheese pieces and avoiding craters and other astronomical objects, such as comets and planets, on a moon made of cheese.
Stars: ✭ 32 (-69.23%)
Mutual labels:  moon
moon-cli
✨ Easily scaffold a Moon project
Stars: ✭ 27 (-74.04%)
Mutual labels:  moon
hodlmoon
A command line tool for crytocurrency data. When moon?
Stars: ✭ 25 (-75.96%)
Mutual labels:  moon
Moonwards-Virtual-Moon
Development continues on Unreal, in the MoonwardsUE repository
Stars: ✭ 97 (-6.73%)
Mutual labels:  moon
menu-circular
Menu circular desarrollado con C# en Unity3D
Stars: ✭ 18 (-82.69%)
Mutual labels:  moon
TacticTurnBased
Prototipo inicial de un juego tactico. Este proyecto solo alberga unos pocos assets con licencia free y el core de un sistema de combate tactico por turnos.
Stars: ✭ 28 (-73.08%)
Mutual labels:  moon
UGUI-Effect
Efectos para la nueva UI
Stars: ✭ 14 (-86.54%)
Mutual labels:  moon

Lune Build Status

Lune.js — calculate the phases of the moon.

Installation

npm install lune

Usage

To calculate current phase information:

var lune = require('lune')
var current_phase = lune.phase()
console.log(current_phase)

Output:

{ phase: 0.3435664924086369,
  illuminated: 0.7773055846628978,
  age: 10.1457207715498,
  distance: 386679.7626047325,
  angular_diameter: 0.5150467579643708,
  sun_distance: 148929846.0148686,
  sun_angular_diameter: 0.5354732715700135 }

To calculate phase information for a specific date:

var lune = require('lune')
var some_date = new Date('2014-02-17T00:00-0500')
var some_date_phase = lune.phase(some_date)
console.log(some_date_phase)

Output:

{ phase: 0.568204641580006,
  illuminated: 0.9547862069882863,
  age: 16.779417556565985,
  distance: 396084.54752883443,
  angular_diameter: 0.5028172882344054,
  sun_distance: 147822484.14817196,
  sun_angular_diameter: 0.5394845874736046 }

To search for recent phases around the current date:

var lune = require('lune')
var recent_phases = lune.phase_hunt()
console.log(recent_phases)

Output:

{ new_date: Tue Mar 08 2016 20:55:59 GMT-0500 (EST),
  q1_date: Tue Mar 15 2016 13:04:23 GMT-0400 (EDT),
  full_date: Wed Mar 23 2016 08:01:38 GMT-0400 (EDT),
  q3_date: Thu Mar 31 2016 11:18:41 GMT-0400 (EDT),
  nextnew_date: Thu Apr 07 2016 07:25:20 GMT-0400 (EDT) }

To search for recent phases around a specific date:

var lune = require('lune')
var some_date = new Date('2014-02-17T00:00-0500')
var some_date_phase = lune.phase_hunt(some_date)
console.log(some_date_phase)

Output:

{ new_date: Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
  q1_date: Thu Feb 06 2014 14:22:33 GMT-0500 (EST),
  full_date: Fri Feb 14 2014 18:54:46 GMT-0500 (EST),
  q3_date: Sat Feb 22 2014 12:16:56 GMT-0500 (EST),
  nextnew_date: Sat Mar 01 2014 03:02:41 GMT-0500 (EST) }

To search for phases between two dates:

// print all full moons in the first quarter of 2014
var lune = require('lune')
var phase_list = lune.phase_range(
  new Date('2014-01-01T00:00:00.000Z'),
  new Date('2014-03-31T23:59:59.999Z'),
  lune.PHASE_FULL
)
console.log(phase_list)

Possible values for the third argument of the function are:

  • lune.PHASE_NEW (new moon)
  • lune.PHASE_FIRST (first quarter moon)
  • lune.PHASE_FULL (full moon)
  • lune.PHASE_LAST (third or last quarter moon)

Output:

[ Wed Jan 01 2014 06:15:02 GMT-0500 (EST),
  Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
  Sat Mar 01 2014 03:02:41 GMT-0500 (EST),
  Sun Mar 30 2014 14:48:06 GMT-0400 (EDT) ]

Image

Moon image graciously provided by Mike DiLuigi.

Contributing

Please feel free to contribute to this project! :) Pull requests and feature requests welcome!

License

See LICENSE file in this repo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].