# Animate hands to zero (in a "real" chronograph)

Objective: Create a “real” chronograph, in which hour and minute hands is turned to zero prior to starting the stopwatch.

I’m trying to do this: Add a button (i.e. an element) at, let’s just say, 2 o´clock. When this button is activated, I want the hour hand and the minutes hand to animate to 12 o’clock (zero) and stay there, so I can active the chronograph and use the second hand as stopwatch.

I can easily make the hand jump instantly to zero when stopwatch is started using this:
\$#SWES#>0?0:#DWFMS#\$ (this move the hour hand to zero once I start the stopwatch)

How to I make the hand move/animate to 12 o’clock (zero) over a period of 1 second, regardless of what time it is showing? I think I need to use the interpAccel function, but can’t make it work.

So, for the minute hand:

Starting position is #DWFMS#
End postition should be 0
Animation should happen during 1 second.

Is there a savy watch developer who knows how to do this??

Hi @haugaards
I didn’t quite understand what you mean. Do you want park hands at 12 using the chrono?
If yes you can try these formulas:

Rotation for:
Hours = \$#SWISRUNNING#=true?0:#DWFKS#\$
Minutes = \$#SWISRUNNING#=true?0:#DWFMS#\$
Seconds = \$#SWISRUNNING#=true?0:#DWFSS#\$
where 0 = 12 oclock position. If you change 0 with another number you change the position where to park hands. I.E. if you put 60 instead of 0, you will have your hands parked at 2 O’ clock.
if i remember well i saw the formula in another post and was @kvansant to provide the solution.

Hi diavo

Thanks for the reply. I might have been unclear, so I’ll have to do better:

I am trying to simulate an old fashion chronograph, with real hands that is mechanically moved to 12 o´clock before the chronograoh is started. The formula you suggest works, but the handles jump instantly to 12. I want them to animate to 12, for example during a one-second animation, so that I can see them move there.

I hope this makes better sense!

Do you want all hands to move to 12 and have the second hand move as the chrono? or do they all have to move?
Also, does the chrono have to be smooth or ticks?

I have placed an Action element at 2 o´clock with a VAR_1. When this is tapped, I want the hour hand and minute hand to animate to 12. Then I can start the chrono with the secondhand (like a real chronograph). When done, I want minute and hour hand to animate back to showing the time.

I all works, but without the animation. I’m thinking a 1 second time frame is a good start as duration for the animation. I just need to find the right expression.

BTW: it will go in this rotation expression:
\$#VAR_1#=1 ? [animation here] : #DWFM#\$

Chrono can tick or be smooth, not so important (I can use #SWES, but I guess ticks would be cool as well)

ok, parking the hands based on a var tap is different, I thought you wanted them to park when starting the chrono, but you are starting the chrono with a different action

`\$#VAR_1#==1?(#DWFMS#-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*#DWFMS#)):#DWFMS#\$`

the “1000” in that expression is the duration in ms

1 Like

And you need animation on both sides of the “if” to also animate it back afterwards:
`\$#VAR_1#==1?(#DWFMS#-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*#DWFMS#)):(interpDecel((#DNOW#-#VAR_1_T#),0,1000,1)*#DWFMS#)\$`

1 Like

That’s it!! You are brilliant! Thanks a lot.

Just out of curiosity: What parameter make the hand slow down at the end, and speed up at the beginning when it returns?

There is interpAccel, which accelerates an interval. It is used as interpAccel(current, begin, end, acceleration).
The opposite is interpDecel, which decelerates an interval.

In the example I gave you I use “current” = `#DNOW#-#VAR_1_T#` which gives me the ms since the button is pressed. I use 0 as begin and 1000 (1 second) as end. The acceleration is 1 (you can play with numbers between 0 and 1 and see the effect).

Both interp… functions generate a number from 0 to 1, and you can use that to multiply it with your value to get a smooth transition.

OK. Thanks a lot for all your help. Extremely valuable input!

1 Like