-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript
86 lines (73 loc) · 2.86 KB
/
script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
-- main script
--
-- Formulas from the book Astronomical Algorithms - Jean Meeus
-- Custom Ulysse Nardin's Executive Moonstruck Worldtimer for Watchmaker
-- Original work of Mark Segraves
-- https://plus.google.com/109873773018255084880/posts/EDytzFsKEot
-- Watchmaker file https://we.tl/h0cVHv94P1
var_timeAdd = 0
var_s_moonAngle = 0
var_s_nodeAngle = 0
var_a = -138
var_scaleFactor = 0.895
var_zoomSpeed = 0.3
tweens.scale = 0.895
var_zoom = true
tweens.tap = 0
tweens.lockmess = 0
var_TapDelay = 0.5
var_mode = 0
var_lock = 0
var_mSpeed = 3
tweens.m = 0
var_dim = 1
var_offset = math.abs( {dutcoff}%100 ) / 30 + math.floor( math.abs( {dutcoff}/100 ) ) * ({dutcoff}<0 and -1 or 1) --> Convert dutcoff to decimal: +0130 becomes 1.5
function on_second()
local JD0= JulianDay0()
local JD=JulianDay()
local T = (JD - 2451545 ) / 36525 --> Meeus 12.1
local T0 = (JD0 - 2451545 ) / 36525 --> Meeus 12.1
local GMST = ( (280.46061837 + 360.98564736629 * (JD - 2451545) + 0.000387933*T0*T0 - T0*T0*T0/387100000) % 24 )*15 --> Meeus 12.4
local moonmeanlon = (218.3164477 + 481267.88123421*T - 0.0015786*T*T + T*T*T/538841 - T*T*T*T/65194000) % 360 --> Meeus 47.1
local moonmeannode = (125.0445479 - 1934.1362891*T + 0.0020754*T*T + T*T*T/467441 - T*T*T*T/60616000) % 360 --> Meeus 47.7
var_s_moonAngle = GMST - moonmeanlon + {alon} + 180
var_s_nodeAngle = GMST - moonmeannode + {alon} + 180
end
function tweenme(f, t)
wm_schedule{action = 'tween', tween = 'scale', from = f, to = t, duration = var_zoomSpeed, easing = inOutCubic}
end
function dimmess()
wm_schedule{action = 'tween', tween = 'm', from = 200, to = 0, duration = var_mSpeed, easing = outInExpo}
end
function lockmess()
wm_schedule{action = 'tween', tween = 'lockmess', from = 200, to = 0, duration = var_mSpeed, easing = outInExpo}
end
function tap()
wm_schedule{action = 'tween', tween = 'tap', from = 1, to = 0, duration = var_TapDelay, easing = linear}
end
-- *** Julian date UTC 00:00
function JulianDay0(y, m, d)
local y = y or {dyy}
local m = m or {dn}
local hutc = {dh23} + {dm}/60 - var_offset --> Decimal UTC Hour and minutes
local d = d or {dd} + (hutc >= 24 and 1 or hutc<0 and -1 or 0) --> UTC a day before or after
local u = y-2000
local Deltat = 0 --> Delta t Meeus 10.2
if m < 3 then
y = y-1
m = m+12
end
-- Delta t for Dynamic Time fix of seconds:
-- Deltat = (62.92+0.32217*u+0.005589*u*u)/86400 --> Meeus 10.2
return math.floor( 365.25 * (y+4716) ) + math.floor( 30.6*(m+1) ) + d + 2 - math.floor( y/100 ) + math.floor( y/400 ) - 1524.5 + Deltat --> Meeus 7.1
end
-- *** Julian date UTC at UTC now
function JulianDay(y, m, d)
local y = y or {dyy}
local m = m or {dn}
local s = 0
-- Precision of seconds:
-- s = {ds}/3600
local d = d or {dd} + ( {dh23} + {dm} / 60 + s - var_offset ) / 24 --> UTC a day before or after
return JulianDay0(y,m,d)
end