We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
First of all, thanks for your library. I am not exploring yet, but it's definitively quite something !
Using your library, I am trying to reproduce the following moon phase indicator : http://www.patek.com/en/collection/movements-complications/moonphase-indicator
For now, I've something like this:
this.illum = this.getMoonIllumination(new Date()); this.pos = this.getMoonPosition(new Date(), 0, 0); this.angleMoon = this.illum.angle - this.pos.parallacticAngle;
Which gives me the actual moon position at Date() rather than the moon phase.
I've tried to adapt the calculation so they match this code by Xavier Jubier, without success:
/** * The following code is * Adapted from http://xjubier.free.fr/en/site_pages/LunarEclipseCalculator.html * Copyright Xavier Jubier */ var myPhaseName = ""; var forecastImage = new Array(); function moonPhasePercent(theDate) { var synodic = 29.53058867; var msPerDay = 86400000; var baseDate = new Date(); baseDate.setUTCFullYear(2005); baseDate.setUTCMonth(4); baseDate.setUTCDate(8); baseDate.setUTCHours(8); baseDate.setUTCMinutes(48); var diff = theDate - baseDate; var phase = diff / (synodic * msPerDay); phase *= 100; phase %= 100; if ( phase < 0 ) phase += 100; return(phase); } function getMoonPhase() { var theDate = new Date(); var phasePercent = moonPhasePercent(theDate); var phaseNames = [ "New Moon", "New Moon", "Waxing Crescent", "Waxing Crescent", "Waxing Crescent", "Waxing Crescent", "First Quarter", "First Quarter", "First Quarter", "Waxing Gibbous", "Waxing Gibbous", "Waxing Gibbous", "Waxing Gibbous", "Waxing Gibbous", "Full Moon", "Full Moon", "Waning Gibbous", "Waning Gibbous", "Waning Gibbous", "Waning Gibbous", "Last Quarter", "Last Quarter", "Last Quarter", "Waning Crescent", "Waning Crescent", "Waning Crescent", "Waning Crescent", "New Moon" ]; thePhase = Math.round(phasePercent * 0.279); myPhaseName = phaseNames[thePhase]; return thePhase; }
Thanks, M.
The text was updated successfully, but these errors were encountered:
@MathieuNls It is four years or so since I made this but I don't remember this library including a calculation of the phase of the Moon.
Sorry, something went wrong.
No branches or pull requests
Hi,
First of all, thanks for your library. I am not exploring yet, but it's definitively quite something !
Using your library, I am trying to reproduce the following moon phase indicator : http://www.patek.com/en/collection/movements-complications/moonphase-indicator
For now, I've something like this:
Which gives me the actual moon position at Date() rather than the moon phase.
I've tried to adapt the calculation so they match this code by Xavier Jubier, without success:
Thanks,
M.
The text was updated successfully, but these errors were encountered: