[SOLVED] Help with custom rotation for the hours/minutes hands using a variable

Hello! Sorry to jump straight out of the water with a support question to the community but, I can’t for the life of me understand how to do this. Maybe someone here would be willing to give me a hand, or maybe point to a post where I can learn how to do this?

The Idea: is to have a “Nudge” button on my watch face. Once clicked, it will move the hour/minute/seconds hands to specific position so they won’t be covering any important information in the background. Then after 3 seconds or so, they go back to their default jobs (showing the hour, minute, seconds). All of this preferably with smooth animations, as in, clicking the Nudge button won’t just make a hand jump to a different position, but it will rather rotate there and back.

Extra info.:
When pressing the Nudge button, hands should have these rotation values when fully in-place:
Hours: 284
Seconds: 284
Minutes: 75

  • Adding this extra info not because I want someone to do it for me, but rather to keep the information somewhere (for myself) and if someone wants to help and test what they are doing, well, might as well use the preferred values, if they wish :stuck_out_tongue:

It doesn’t sound like it would be hard to do on paper but, I can’t wrap my head around how to do this in the creator, with expressions. All I can manage is to make the hands jump to the desired position with a toggle var, but no idea how to make them smoothly move there, and then 3 seconds later move back. I assume for the 3-second reset I would need to make a timestamp when the button was clicked, and then if 3 seconds have passed from timestamp, reset the toggle… however I’m not even sure where I’d add something like that, least of all with expressions.

Thank you so much in advance to any kind soul willing to lend me a hand and a few minutes of their time o/

EDIT 1: I’ve managed to make a button that puts the hands where I want them for 2.5 seconds, and then they return to give the time normally. What I just can’t do is make the hands move smoothly to the desired position and back, all I can make them do is snap to position 2, then back to their normal position x_x I am now at a 100% dead end.

EDIT 2: This is as far as I’ve gotten:

$(#DNOW#-#VAR_1_T#)<2500?(284):#DWFS#$

The hand (in this case seconds) gets into position (284 rotation) for 2.5 seconds, then back to normal, but it doesn’t do it smoothly, it’s a snap, there’s no rotation :frowning: I’ve tried using clamp but to no avail, though I’ll be the first to admit I’m not 100% sure what I’m doing, even when I manage to get something working lol… I hate math, to boot -.-

1 Like

This seems to work …

$(#DNOW#-#VAR_1_T#)<500?(((#DNOW#-#VAR_1_T#)/500)*(284-#DWFSS#)+#DWFSS#):$$(#DNOW#-#VAR_1_T#)>=500&&(#DNOW#-#VAR_1_T#)<2000?(284):$$(#DNOW#-#VAR_1_T#)>=2000&&(#DNOW#-#VAR_1_T#)<2500?((1-(((#DNOW#-2000)-#VAR_1_T#)/500))*(284-#DWFSS#)+#DWFSS#):#DWFSS#$

But it does make use of the undocumented “$ A ? W : $$ B ? X : $$ C ? Y : Z $” syntax, so I don’t know how reliable it will be.

Anyway, I hope it helps.

2 Likes

Wow… I’m gonna test that straight away, thank you so much! That looked so complicated before you mentioned you’re even using things that are undocumented lol? man… I don’t wanna ask how you even came up with this…

I’ll report back in a sec!

EDIT: So in order to use this for minutes and the hour hand I just need to change the #DWFSS# tag for a minutes and hours one, right? or is it more complicated than that to adapt it?
Sorry if the question seems silly but this is really beyond me lol

Mmm, let me say, I think so ( fingers crossed ) :slight_smile:

If it does not work let me know and I’ll think some more.

Cheers

2 Likes

Oh my god it works like an absolute charm! Thank you so much, brother! I would humbly request a walk-through of what’s going on in here but I’m not gonna put you through that pain lol… though I’ll admit, it’s mostly because I think even after the explanation I’m afraid I won’t understand it :sweat_smile:

So this undocumented stuff, does that mean that it’s new and it hasn’t been properly “released” yet, or… is it going to be deprecated soon? or? Should I worry that this may stop working at some point? and if so, should I already start looking for an alternate way of doing things? Because the other alternate method I was about to try myself (having giving up on this one completely) is to just make it so the needles spin around, like they do in the original hybrid watch I got the idea from, effectively moving out of the way but not necessarily staying anywhere; I figure that might be easier to tackle?

Anyway, I can’t thank you enough for lifting dead weight off my shoulders that I’ve been carrying for like 3 days… Thank you :stuck_out_tongue:

1 Like

You are most welcome - I’m glad it worked. :slight_smile:

The nested if then else syntax has been around a while - if you do a search in the forum for if then else you will see it discussed for couple of years or so. I don’t know if it is a “hack” that just works, a feature that for some reason has not been documented or syntax that may only work in some operating systems or versions thereof. Anyway, some people use it all the time whilst others avoid it just in case. I have not used it in a published face because I have always found a way to achieve what I want to do without it. With your problem though no immediate alternative came to mind.

As for the walk …

The expression breaks down to:

If it has been less than 1/2 sec since button press then rotation equals
hand tag
+ ( the difference between hand tag and 284 ) ie. how far the hand needs to move
* ( the time since button press / 0.5 sec ) ie. a fraction between zero and one

else if the time is after 1/2 sec but less than 2 sec then rotation equals 284

else if the time is after 2 sec but less than 2 1/2 sec then rotation equals
time tag
+ ( the difference between hand tag and 284 ) ie. how far the hand needs to move
* (1-( ( time since button press - 2 sec ) / 0.5 sec ) ie. a fraction between one and zero

else rotation equals hand tag

Cheers
Mike

1 Like

I knew it, black magic… SMH!

Seriously though, that’s awesome. Maybe if I liked math I could have come up with some of those values/steps… but definitely not the whole thing, this was a work of art, and it’s just a little heartbreaking to know that this “if else then” thing might not work for everyone or maybe even stop working at some point :frowning:

Been toying with that alternate method I told you about in an earlier post, just in case, though I can’t get it to work just right; The idea is to just press the button, and have the hands do a full circle around the watch face, albeit at a higher speed, then at exactly 360 degrees + the time that has passed since they did the animation, they go back to normal. To be clear, that last part is just to say that after the full circle, they won’t land where they started, but rather where the hands should now be… if that makes sense xD. My problem is I speed them up, but then they don’t end up quite in the right spot.
I’m far from an expert (hell, can’t even get it to work?), but it feels like this method could be pulled off without the “if else then”… though not really sure.

If I can get this alternate method to work, maybe I can have a toggle button somewhere that changes the behavior of the “nudge feature” on the go, so people can choose the one they like most (or the other one, if one stops working lol).

1 Like

Maybe something like …

$(#DNOW#-#VAR_1_T#)<3000?(#DWFSS#+((#DNOW#-#VAR_1_T#)/3000)*360):#DWFSS#$

Once again I was very far off lol… Let me try that!

Yeah that’s perfect :smiley: and this one shouldn’t break! Thank you again :D!
How would you go about speeding up that latest formula? I’d like to make maybe one or two hands move at slightly different speeds so it doesn’t look as jarring to see it all move at once at the same time xD I imagine maybe I need to add + something somewhere? Or hmm… maybe I just make it take extra laps around the face, like 720 instead of 360…

EDIT: Yeah extra laps works :smiley: whole thing doesn’t look quite as cold when it happens, rather, it looks quite funky xD

1 Like

I can’t find the #DNOW# tag in the documentation. Can you advise what the value represents? If does appear to be related to a DATE value in java for example (which is milliseconds since Jan 1, 1970). However when I do (#DNOW#%86400) I don’t get the number of seconds (or a multiple thereof) into the day.
What I’m after is the number of seconds (or milliseconds) into the current day without having to compare/calculate #DH# and #Dm# and #Ds#.

Thanks!

I think I have it (and had to back out local time zone offset also)

(((#DNOW#+(((#Dk#-#DUH#)-24)*3600000))/1000)%86400)

The number of seconds into the day (in local time).

I’m using this to drive a retrograde date hand which will have opacity 100 except during the first one second of the first day of the month. During that period, I will display the same image but with a fast negative rotation which will bring the hand back to day 1.

1 Like