[SOLVED] How To Tag Moon Phase Today Rotation

I’m trying to make some Chronograph Moon Phase today Rotation following Moon Phases Calendar for reference http://www.moonconnection.com/moon_phases_calendar.phtml

So I’m trying to figure out how to TAG expressions at Rotation

Thanks in advance, :smile:
Ben

Hai Guys,Finally i found calculation of Moon Phase and would like to share mathematical formula for Moon Phase calculation for facer watchface Ref. Teg2 at Ben Daglish -

SW Moon Phase Watchface: G7 - SW Moonphase Indicator v1.6 - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer
They all return a single value - the phase day (0 to 29, where 0=new moon, 15=full etc.) for the selected date.
For Expression at input Text:

(((((floor(365.25*(#DM#<2?(#Dy#-#Dy#):#Dy#)))+(floor(30.6001*((#DM#<=2)?((#DM#+1)+12):(#DM#+1))))+#Dd#+1720995)+2-((#Dd#+31*(#DM#+12*#Dy#))>=(15+31*(10+12*1582))?(floor(0.01*((#DM#<=2)?(#Dy#-#Dy#):(#Dy#)))):(#DM#<=2?(#Dy#-#Dy#):(#Dy#)))+floor(0.25*((#Dd#+31*(#DM#+12*#Dy#))>=(15+31*(10+12*1582))?(floor(0.01*((#DM#<=2)?(#Dy#-#Dy#):(#Dy#)))):(#DM#<=2?(#Dy#-#Dy#):(#Dy#)))))-((2415020+28*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0))))))+((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)))))>0.0?(floor((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))))))):(ceil((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)))))-1.0))))+30)%30)

For Expression at input Rotation:

((((((floor(365.25*(#DM#<2?(#Dy#-#Dy#):#Dy#)))+(floor(30.6001*((#DM#<=2)?((#DM#+1)+12):(#DM#+1))))+#Dd#+1720995)+2-((#Dd#+31*(#DM#+12*#Dy#))>=(15+31*(10+12*1582))?(floor(0.01*((#DM#<=2)?(#Dy#-#Dy#):(#Dy#)))):(#DM#<=2?(#Dy#-#Dy#):(#Dy#)))+floor(0.25*((#Dd#+31*(#DM#+12*#Dy#))>=(15+31*(10+12*1582))?(floor(0.01*((#DM#<=2)?(#Dy#-#Dy#):(#Dy#)))):(#DM#<=2?(#Dy#-#Dy#):(#Dy#)))))-((2415020+28*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0))))))+((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)))))>0.0?(floor((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))))))):(ceil((0.75933+1.53058868*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+((1.178e-4)-(1.55e-7)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))+(0.1734-3.93e-4*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85))*Math.sin(0.017453292500000002*(359.2242+29.105356*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))))-0.4068*Math.sin(0.017453292500000002*(306.0253+385.816918*((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))+0.010730*((((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)*(((floor(12.37*(#Dy#-1900+((1.0*#DM#-0.5)/12.0)))))/1236.85)))))-1.0))))+30)%30)*6)

Feel Free to comparison at http://www.moongiant.com/calendar/
or at others site Lunar / Moon phase Calendar
REF: Single value - the phase day (0 to 29)

    Illumination = %
0 = New Moon: 0%

1 = Waxing Crescent 1%
2 = Waxing Crescent 2% 
3 = Waxing Crescent 6%
4 = Waxing Crescent 11%
5 = Waxing Crescent 17% 
6 = Waxing Crescent 25%
7 = Waxing Crescent 34% 
8 = Waxing Crescent 43%

9 = First Quarter 53%

10 = Waxing Gibbous 63% 
11 = Waxing Gibbous 73% 
12 = Waxing Gibbous 82% 
13 = Waxing Gibbous 90% 
14 = Waxing Gibbous 96%

15 = Full Moon 100%

16 = Waning Gibbous 97% 
17 = Waning Gibbous 97% 
18 = Waning Gibbous 92%  
19 = Waning Gibbous 84%  
20 = Waning Gibbous 75% 
21 = Waning Gibbous 64%  

22 = Last Quarter 53%

23 = Waning Crescent 43%
24 = Waning Crescent 33%
25 = Waning Crescent 24%
26 = Waning Crescent 16% 
27 = Waning Crescent 9%
28 = Waning Crescent 4% 
29 = Waning Crescent 1%

Hope this use full for all’s.

Thank You :smile:

5 Likes

@Ben Great job, this is super cool!

Thank you marcus! for your support and lovely comments.

below its sample of dial moon phase:

@Ben That is amazing!

I have a small problem here:
Your rotation script works great in the editor, but when I load it onto my Sony Smartwatch 3 it is not…

Here is one of my watchfaces using your script, that I can see that problem on: Mellin - URWERK UR-106 Black Pink - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer

@Mellin

For moon phase indicator try use this expression code:

((((((((((((((365*(#Dy#-1))+(((#Dy#-1)/4)-(((#Dy#-1)/4)%1)))-(((#Dy#-1)/100)-(((#Dy#-1)/100)%1)))+(((#Dy#-1)/400)-(((#Dy#-1)/400)%1)))+#DD#)+1)-735486)*24)*60)*60)+((((#DH#*3600)+(#Dm#*60))+#Ds#)-5880))-(3600*7))/5102886)*360) 

hope this help =)

Thanks for answering me!

Unfortunately, it still gives me a different rotation in the editor and on my watch.
In the editor, the rotation is ok (but the rotation is rotated 90 degrees (in relation to those two images of dial moon phase you posted before)).
I compensated for that by rotating image I used as those 2 orbs.

BTW: what is that % symbol in this version of the script?
I cannot find it in documentation.

% is modulo a.k.a. the rest of the integer division, not sure on Facer, but in most language quite “glutton” in CPU.
Extremely useful to get the pari numbers:
0%2 = 0
1%2 = 1
2%2 = 0
3%2 = 1

(#DWFKS#*360) will be from 0 to 360 instead of 15 to 375 :wink:

Cheers,
P.

1 Like

I kind of guessed that much.
What I’m asking: does that % actually work outside the editor, even tho it’s not in the “Math Expressions” part of the Facer Creator Documentation?
Whenever I need rest of the integer division in Facer I usually used something like this:

(((x/2)-floor(x/2))*2)

Using % would help me so much…
if it works.

Anyway, I created this:

((((((((((#DH#/24)+#DD#)*3)/1096)+#Dyyyy#)/(850481/10521600))-floor((((((((((#Dsm#/60)+#Dm#)/60)+#DH#)/24)+#DD#)*3)/1096)+#Dyyyy#)/(850481/10521600)))*180)+11)+90)

Based on moon’s phases period - (850481/10521600) in years.
It gives me back rotation of moon dial from 0-180 (where 90 is the full moon).

I still don’t know, why your script doesn’t work for me, but still, thank you for your help.

Hai Guys… i try to update calculation Moon Phase and would like to share mathematical formula for Moon Phase calculation for facer watchface following below:
JD = Julian Day SYNODIC_PERIOD = 29.530588853 // days for the mean synodic month JDNM = 2451550.1 // Julian Date A new moon occurred at (January 6, 2000). Then it is easy to count the number of days since the last new moon. JD = ((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5) A = (JD - JDNM) / SYNODIC_PERIOD B = (((A)-floor(A))*SYNODIC_PERIOD) Moon_Age = (Math.round((D*1000)/10)/100) // Round a Decimal value to 2 Decimal places xx.xx

Tag Expression Text:
Moon Age (Math.round((((((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853)-floor((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853))*29.530588853)*1000)/10)/100) Days

2 Likes

For Tag Expression Rotation:
((Math.round((((((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853)-floor((((367*#Dy#-((7*(#Dy#+((#DM#+9)/12)))/4)+((275*#DM#)/9)+#Dd#+1721013.5+#Dk#/24)-0.5*((100*#Dy#+#DM#-190002.5)/abs(100*#Dy#+#DM#-190002.5))+0.5)-2451550.1)/29.530588853))*29.530588853)*1000)/10)/100)*12.19074911753505)

visit here for reference: G7 - SW Moonphase Indicator v1.6 - watch face for Apple Watch, Samsung Gear S3, Huawei Watch, and more - Facer
“Inspector Mode” Available :slight_smile:

I hope it will be useful for alls… :slight_smile:

3 Likes

I know it’s a bit old thread, about calculating the Moon rotating, and Moon days. But Ben, despite you’r great Job with you’r calculation, it’s not correct. I took a look at you’r Link to the watch, which shows you’r rotating Moon, and the Lunar day, and the Moon goes much behind what’s correct. Take a look at my own Weather Site Aktuelle vejrdata fra Nakskov (look in the bottom of the Site)
It shows the exact position of the Moon, and where it is located on the Sky, and the Moon Rise, and Set.

I’m trying to figure out, an accurate script for Facer use, for the Moon rotation on a new watch I’m building up. Not a Moon rotating the traditionally way, but a fully rotation, showing images for each of the Moon days. But so far, it’s a bit of a “fight” to get it to works.
I tried doing it on Samsung’s Gear watch Designer, as they have a script build in to there designer, and it works perfectly on the minute; but unfortunately, you can’t see how this script are build :frowning:

2 Likes

Thank you for your comments… :slight_smile:
All the moon phase that I post the calculations is just about any less
about fully rotation, showing images for each of the Moon days
maybe the links below can help.

about position of the Moon, and where it is located on the Sky, and the Moon Rise, and Set. it requires a very long script that is quite difficult to put on the line tag. if the facer can provide the use of lua script it may be helpful. :slight_smile:

1 Like

@G7 - Great Job! I noticed, that you have turned the “Moon Ring” 180 degrees wrong :wink: The Moon is waning now.
I look forwards to that day, where it will be implemented as Tag, to have the GPS info. Then it will be more Fun and interesting, to “play” with Sun and Moon positions, and the rotations.

1 Like

yes… :grinning: you right the moon is waning crescent now around 19 to 20 age days.
for the moment I have not seen providing about GPS info for implemented as Tag this link as a reference Tags | Facer Documentation

OH!!! i’ve been looking for modulo for so long! Hope Facer adds it to the docs :slight_smile:

And BTW, I’ve been working on moonphase on my own and I’m not much of a mathematician, but it seems I’ve come up with something that works (U’ll find it here : https://www.facer.io/watchface/9L6tZ49qzs )

My Formula is much simpler (and therefore probably wrong) :

October 19 2017 (day 292) was a new moon so i get a second value for that day:
(292*86400)+(2017*31557600))

The Current day in second is:
((#DD#*86400)+(#Dy#*31557600))

I find the delta between the 2 values :
(((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))

Then I divise it by 29.5530588853 day (multiplied by seconds per day)
((((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))/(29.5530588853*86400))

Then i keep only the decimal
(((((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))/(29.5530588853*86400))-floor(((((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))/(29.5530588853*86400))))

Then I convert this into an angle starting from -90° and going to 90°:
(((((((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))/(29.5530588853*86400))-floor(((((#DD#*86400)+(#Dy#*31557600))-((292*86400)+(2017*31557600)))/(29.5530588853*86400))))*180)-90)

VOILA :slight_smile:

2 Likes

@ elv3n12 thank you sharing :slight_smile:

Hi,
Love your moon phase. I would like to add one to my watch face as I fly a rescue helicopter with NVG’s and moon phases is incredibly important. Can you tell me where you got your moon image and any other instructions you could give me please?
Kind Regards,
Peter

Thanks. I found the image on google very simply. I used Moon Phases 2019 – Lunar Calendar to figure out the new moon date.

is this designed for use in both the northern and southern hemispheres?