# Spent a lot of time on proper orbits

I just finished my first complex watch face. This face includes some nice layering, day/night fading and a sun and moon that orbit properly around the sky. I had looked into the orbit tutorial available in the documentation and came to the conclusion that the math wasn’t quite right. If I uses the provided equations the orbits would jump ahead at 1am. Being a game developer I rewrote the math to properly calculate the angle in radians that the sun and moon should be at based on the hours, minutes and seconds.
Here is a sample of that equation:

``````(160 + cos((((#DH#+(#Dm#/60)+(#Ds#/3600)+18)/24)*360)*((pi)/180))*130)
(160 + sin((((#DH#+(#Dm#/60)+(#Ds#/3600)+18)/24)*360)*((pi)/180))*130)
``````

A breakdown of what that equation looks like is:

Origin + sin(AngleInRadians + RotationOffset) * radius

Here is my face, feel free to inspect it to see those calculations in action.

8 Likes

Hey, that is really awesome! Fantastic idea/execution of the smooth transition effect. I’m purely a mechanical/analog watch guy so this isn’t really my style but I can totally appreciate what you’ve done here, nice! I feel like you could go a little darker with the night sky, what do you think?

Well done, thanks for sharing!