Sundial on Half Circle

I am having trouble figuring out how to make this work. I have a sub dial on my watch, the sub dial has ticks from 170-90 (left to right). I am trying to figure out how get my dial rotation to go between the two as a progress bar from sun rise to sunset. How do I determine the difference between the two and start the rotation at 170?

I am learning slowly, but any help is so much appreciated.

2 Likes

Welcome . There is help. I am really busy at the moment. For what yoy want too see it will be difficult to scale it to sunrise Sunsert tines. But a simple 6 till 6 thing is easily achievable. More soon.

1 Like

This might work but I have not tested it …

Sunrise hours: (#WSUNRISEH24#+(#WSUNRISEM#/60))
Sunset hours: (#WSUNSETH24#+(#WSUNSETM#/60))
Difference: ((#WSUNSETH24#+(#WSUNSETM#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))
Hours since sunrise: ((#Dk#+(#Dm#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))

If you want the bar to be empty at night, then
Fill ratio: $(#Dk#+(#Dm#/60))<(#WSUNSETH24#+(#WSUNSETM#/60))?(clamp((((#Dk#+(#Dm#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))/((#WSUNSETH24#+(#WSUNSETM#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60))))*(280/360)),0,(280/360)):0$

If you want the bar to be empty before sunrise but full after sunset then:
Fill ratio: (clamp((((#Dk#+(#Dm#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))/((#WSUNSETH24#+(#WSUNSETM#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60))))*(280/360)),0,(280/360))

Rotation: 170

Notes:

  • the conditional statement is used to make the bar empty if current time is after sunset
  • the clamp function is used to make the bar empty if the current time is before sunrise
  • the value (280/360) is the maximum fill ratio you want for a bar going from 170 to 90
  • I imagine that there is a more elegant solution but I think the above should work

Also, there was ( a long time ago, possibly now fixed ) a problem with weather data not being requested by the face if the face does not include the tag #WCT#. So, you might want to include a dummy layer where you include #WCT# because the sunrise and sunset values come from the weather data.

5 Likes

Cool, I look forward to it. THnak you.

2 Likes

I am not doing a bar fill, I am trying to get a hand to point straight left at sunrise, then curve over to straight right ant sunset. Maybe I am misunderstanding what you are saying. I do appreciate the folow up and help.

3 Likes

@totallyjuvenile I will post a Test Here I did for someone else in case this is what you are looking for . Please inspect it for the Maths etc. Mike O’Day is a Grand Master . I think you are looking for something more simple . You will get there one day .

BTW you were talking about a Progress Bars when you started the topic . That is why Mike was giving you formulas for that , which is quite complex. Progress bars and Hands are very different. Obviously in this case the hands are images with their centres at the pivot point .

You will see for the strange little moon sequence there is a different way of rotating it . This is because the GIF has no pivot point . Ignore this for now and look at the MOP Moon . Unless of course you understand what is going on there .

2 Likes

I see why the confusion on the progress bar… Looks like this watch isn’t set up for inspection, but I can see what you are talking about now by a 6am to 6pm thing. Let me post what I am trying to do here… On the left sub dial, I just want the arrow facing left at sun up, and right at sundown. Rather than use set times, I would like to use the correct sunup and sundown times.

2 Likes

My bad I meant go between the two instead of a progress bar. Sorry for the confusion.

2 Likes

All good. What did you want the hand to do at night?

1 Like

That sir… Is a really good question. I guess it can keep circling…

2 Likes

Also can I say WOW, thanks for helping… I just realized like have the watched I have purchased are yours!! I’m a huge fan

2 Likes

So it is a lot easier to have a progress bar that begins and ends at SR and SS and have a hand that runs between . I would not possibly know how to scale the daylight between two fixed points . So it is very late for me . I will post something inspectable for you . The other one is by the way . I must say goodnight .

2 Likes

Thank you and you are most welcome.

So, you would set the x and y positions for the centre rotation point as usual and then there will be two cases for the rotation.

one: rotate 180 degrees during the hours between sunrise and sunset, &
two: rotate 180 degrees during the night between sunset and sunrise

Sunrise hours: (#WSUNRISEH24#+(#WSUNRISEM#/60))
Sunset hours: (#WSUNSETH24#+(#WSUNSETM#/60))

Difference Sunrise to sunset: ((#WSUNSETH24#+(#WSUNSETM#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))
Hours since sunrise: ((#Dk#+(#Dm#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))

Difference sunset to sunrise: (24-(#WSUNSETH24#+(#WSUNSETM#/60))+(#WSUNRISEH24#+(#WSUNRISEM#/60)))
Hours since sunset, if before midnight: ((#Dk#+(#Dm#/60)))-(#WSUNSETH24#+(#WSUNSETM#/60)))
Hours since sunset if after midnight: = ((24-(#WSUNSETH24#+(#WSUNSETM#/60)))+(#WSUNRISEH24#+(#WSUNRISEM#/60)))

Now, I think this will be easier with more than one hand and with opacity set depending on the time.

Hand 1: Sunrise to sunset

Rotation: ((((#Dk#+(#Dm#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60)))/((#WSUNSETH24#+(#WSUNSETM#/60))-(#WSUNRISEH24#+(#WSUNRISEM#/60))))*180+270)

Opacity: $(#Dk#+(#Dm#/60))>=(#WSUNRISEH24#+(#WSUNRISEM#/60))&&(#Dk#+(#Dm#/60))<=(#WSUNSETH24#+(#WSUNSETM#/60))?100:0$

Hand 2: Sunset to midnight

Rotation: ((((#Dk#+(#Dm#/60))-(#WSUNSETH24#+(#WSUNSETM#/60)))/(24-(#WSUNSETH24#+(#WSUNSETM#/60))+(#WSUNRISEH24#+(#WSUNRISEM#/60))))*180+90)

Opacity: $(#Dk#+(#Dm#/60))>(#WSUNSETH24#+(#WSUNSETM#/60))?100:0$

Hand 3: Midnight to sunrise

Rotation: ((((24-(#WSUNSETH24#+(#WSUNSETM#/60)))+(#WSUNRISEH24#+(#WSUNRISEM#/60)))/(24-(#WSUNSETH24#+(#WSUNSETM#/60))+(#WSUNRISEH24#+(#WSUNRISEM#/60))))*180+90)

Opacity: $(#Dk#+(#Dm#/60))<(#WSUNRISEH24#+(#WSUNRISEM#/60))?100:0$

…

{ edit: Rotation expression for hand 2 above has been updated to fix bracket problem }

4 Likes

That sounds pretty good, I guess that would mean the hand would rotate at different speeds between them. If it is easier, I can just have the arrow sit ad the right end point until midnight and the sit at the left endpoint until sun up…

1 Like

Lots of great stuff here guys! :clap::clap::clap:

2 Likes

Ok I think that is done. Three hands to cover the options.

Please let me know if the expressions don’t work and I will debug them.

:grinning:

2 Likes

You are amazing. Everything works except 1. I have tried to debug myself, but you are far beyond me at this point.
When Arrow 2 (PM after sunset) becomes visible, the rotation isn’t right, it just points straight up.

1 Like

Bracket problem I think. Try this one: ((((#Dk#+(#Dm#/60))-(#WSUNSETH24#+(#WSUNSETM#/60)))/(24-(#WSUNSETH24#+(#WSUNSETM#/60))+(#WSUNRISEH24#+(#WSUNRISEM#/60))))*180+90)

5 Likes

By the way, if you would rather have the hand not move during the night phase then you just need to replace the rotation expressions for hands 2 & 3 with fixed values. 90 and 270 or whatever you want.

3 Likes

That worked. However I am going with the set rotational values. As long as the opacity works, then this works great. Thank you so much!!!

3 Likes