Help!!! I have tried to paste in several different equations but none of them work as I am wanting. I have a background that I would like to rotate from 3 o’clock to 9 o’clock and then reverse direction back to 3 o’clock. This cycle (3-9-3) should take 29.5 days to complete its movement. If it is easier, I would even be willing for a cycle to complete every 30 days. This is a moon cycle that only appears in an upper window. The movement is a rocking motion that repeats nonstop. Please help me insert the right equations for this process.

# Background Rotation

Hi. The rotational moonphase formula is very difficult and i don‘t think you will find someone who can solve your special problem. The only one i know may be @mikeoday, he is very good in coding.

I can give you a formula for a 360 degrees rotation (180 degrees for a full cyle), maybe you can adapt it and cover the part you don‘t need with another layer.

Greetings, GAUSS.

Ha, flattery will get you everywhere @GAUSS!

Ok, let me work the problem…

Seconds in one day: 24 x 60 x 60 = 86,400

Seconds in average lunar month = 29.530587981 x 86,400 = 2,551,442.80156

milli Seconds in average lunar month = 2,551,442,802

Desired range of rotation 180 degrees offset by 90

Positive rotation: ((((#DNOW#%2551442802)/2551442802)x180)+90)

Negative rotation: (270-(((#DNOW#%2551442802)/2551442802)x180))

Test: (#DNOW#%(2x2551442802))<2551442802 then positive rotation else negative rotation

Combined:

```
$(#DNOW#%(2*2551442802))<2551442802?((((#DNOW#%2551442802)/2551442802)*180)+90): (270-(((#DNOW#%2551442802)/2551442802)*180))$
```

Optimised:

```
$(#DNOW#%5102885604)<2551442802?(((#DNOW#%2551442802)/14174682.2333)+90): (270-((#DNOW#%2551442802)/14174682.2333))$
```

I think that might work.

Now, the above will just give you a rotation from an arbitrary start point that won’t coincide with an actual moon phase. Let me look up the correction …

…

Ok, a correction that can be used is to subtract the following from #DNOW#: 583,104,471

This is for the new moon. That is, the new moon will be at either end of the cycle with the full moon in the middle.

So corrected rotation becomes:

```
$((#DNOW#-583104471)%5102885604)<2551442802?((((#DNOW#-583104471)%2551442802)/14174682.2333)+90):(270-(((#DNOW#-583104471)%2551442802)/14174682.2333))$
```

…

Note that the above is an approximation of the actual moon phase which can vary by up to 14 hours or so from the average phase obtained by assuming a circular orbit with a fixed period of 29.53 days.

I knew you can do.

Great job!

Incredible!

@mikeoday for mathematical calculations

@gauss for graphics

I … feed on the knowledge of both of us, at all times continuing in this particular moment of our life.

Thank you for the formula. The movement that your formula creates is acceptable for this watch face. I would like to ask you another question. Are these calculations made using calculus?

I am glad it worked ok.

The expressions are just based on fractions …

(number of milliseconds since last new moon ) /

(number of milliseconds in a lunar cycle )

gives an increasing number from 0 to 1

multiplying this by the desired angle gives the rotation

Based on moon age (formulae):

`((#DNOW#/8.64e7-6.8583)%29.5306)`

I get the following:

`(abs((1-((#DNOW#/8.64e7-6.8583)%29.5306)/14.7653)*180)+90)`

- moon age ::
**0 … 29.53**(days) - divided by 29.53/2 ::
**0 … 2**(plus fractional) - 1 -
*x*::**-1 … 0 … 1** -
*x** 180 ::**-180 … 0 … 18**0 (angle) - abs(
*x*) ::**180 … 0 … 18**0 (angle) - adjust angle 90 degrees

An elegant solution, well done!