Cogs? Rotation with stops

Does anyone know how to make a cog expression? For instance if I had a six sided object and I want it to spin, that seems pretty easy to do:

But what if I wanted a cog to ā€œpauseā€ every 60 degrees to stop at each side? I can use the following expression to get it to ā€˜tickā€™ by 90 degrees every second: (#Ds#*60)
How could I show an animation of it moving from point to point? This is a hard movement. Iā€™ve tried a few variations of the InterpAccel () expression but canā€™t seem to make it work. Also what if I wanted to get the movement to 90 degrees on each tick, but wanted it to take place every 0.75 seconds?

try -(#Ds#*30)

Hello @eradicator09,

which one do you like more? :wink:

3 Likes

Hey @Tomas sorry for the late reply. I guess my ultimate goal would to have each side of the hexagon play (and stop) at least once over a five second period. Iā€™ll message you the idea Iā€™m thinking about.

Hi @eradicator09, now (after reading your message) I see what you are on :wink:

I do not have the solution for your goal right now - I will try to find one.

Anyway if somebody would like to turn a hexagon in the way I shows up, here are the formulas. Both are working with two objects - static one and one in motion.

STANDARD ROTATION

Object A

Rotation:

(-30+(#Dsm#/5*360))

Transparency:

$((#Dsm#/2.5)-(floor(#Dsm#/2.5)))<0.33?100:0$

Object B (Copy)

Rotation:

30

Transparency:

$((#Dsm#/2.5)-(floor(#Dsm#/2.5)))>=0.33?100:0$

SMOOTH (CO)SINUSOID ROTATION (I recommend ;))

Object A

Rotation:

(0+(30*(cos(((#Dsm#-#Ds#)2pi))))))

Transparency:

$(#Dsm#-#Ds#)>0.5?100:0$

Object B (Copy)

Rotation:

-30

Transparency:

$(#Dsm#-#Ds#)<=0.5?100:0$

1 Like

Hi @eradicator09! Here is the expression you could probably use for your purposes (with only one object):

Movement 1 s

$((floor(#Dsm#/1))-((floor(#Dsm#/10))10))=0?(60((floor(#Dsm#/10))+(#Dsm#/1)-(floor(#Dsm#/1)))):(60*(1+(floor(#Dsm#/10))))$

or

Movment 0.5 s

$((floor(#Dsm#/0.5))-((floor(#Dsm#/10))20))=0?(60((floor(#Dsm#/10))+(#Dsm#/0.5)-(floor(#Dsm#/0.5)))):(60*(1+(floor(#Dsm#/10))))$

It was a nice challenge for my :wink: thanks!

2 Likes

I think I could probably use this one to the same effect. Thanks for the assist. I have too many ideas that are half baked right now and not enough time to execute them.

1 Like

Iā€™ve been looking into this and I might have the beginning to a solution. Iā€™ll test it a bit more to see if the concept can be scaled up, but for now this produces a smooth second tick:

$(#DWFSS#-#DWFS#)>=5?(#DWFS#-30)+((#DWFSS#-#DWFS#)*6):#DWFS#$

So, we want something to rotate by a certain degree every nth time unit. This is trivial.

#DWFS#

Every second, the variable updates with a new value. But itā€™s not smooth movement. To get the smooth movement we need to add in some finer detail, but we only want it added at the last part of the second, not the whole. We can do this by using a conditional clause:

$(#DWFSS#-#DWFS#)>=5?#DWFSS#:#DWFS#$

The first part takes the smooth rotation and removes the seconds. We get a constantly changing value between 0 and 6. As long as itā€™s lower than 5 (the first 5/6:s of the second) it just displays the second normally, but as soon as it enters into the last 6:th of the second it displays the fine detail version.

This presents us with a problem. When the detail kicks in, it is already above 5 and will start from that point. It will jump to that point and then travel to the second where it will pause until it jumps again. Since we need it to start from 0 and not 5, we simply subtract 5 from it. This way, it will count from -5 and by the time it kicks in it will have reached 0 to start from there.

$(#DWFSS#-#DWFS#)>=5?#DWFSS#-5:#DWFS#$

And now we have the same problem, but in the opposite direction. It starts alright, but jumps to the next second after travelling 1/6:th of the way. We need to speed it up 6 times to make it travel the entire way and we can do that through simple multiplication. But we canā€™t use it on #DWFSS# since that would throw the whole rotation out of sync. So we extract the difference in the same way we did in the start and use that.

$(#DWFSS#-#DWFS#)>=5?(#DWFS#-30)+((#DWFSS#-#DWFS#)*6):#DWFS#$

I use #DWFS#+(#DWFSS#-#DWFS#) to get the whole second rotation plus the smooth values. This is functionally equivalent to just using #DWFSS#, but it allows us to apply math to the seperate parts. I multiply the smooth motion by 6 to make it go six times faster and I subtract 30 from the whole seconds to offset the start. Since the rotation is now much faster, the offset needs to be larger. I get it by multiplying the 5 and the 6. This now produces a rotation every second that is smooth and lasts for 1/6:th of a second.

By altering the time units and the offset this should work for slower animations as well, including a rotating gear. Iā€™ll look into this further, but wanted to post about it so that others might benefit from it. Hope it helps.

So, Iā€™m starting to get a grip around how to use the formula to produce the asked-for result. This is what Iā€™ve got so far.

In order to make the cog rotate by 60 degrees I need a time unit that updates six times with 60 degrees difference. Thatā€™s easy. The following formula gives us that time:

(60*(floor(#Ds#/10)))

I now simply substitute all instances of #DWFS# with this formula, but I need to make some other changes before it works. Iā€™ll need to set the cutoff, the speed multiplier and the offset.

Calculating #DWFSS# minus (60*(floor(#Ds#/10))) will give me a number between 0 and 60. If I show a change when itā€™s above 5 it will move most of the time so I have to adjust that number. This, in turn, will make me have to change the speed multiplier (*6 in my previous example) and the offset (-30 in my previous example) to match.

Letā€™s try 45 as my cutoff value. I can calculate the correct speed multiplier like this:

Max difference / ( Max difference - Cutoff )

And, with the correct values:

60/(60-45)

This gives me 4 as the multiplier. To get the final value, the offset, I multiply the speed with the cutoff. 45 * 4 is 180 and I put that in. The complete formula looks like this:

$(#DWFSS#-(60*(floor(#Ds#/10))))>=45?((60*(floor(#Ds#/10)))-180)+((#DWFSS#-(60*(floor(#Ds#/10))))*4):(60*(floor(#Ds#/10)))$

Thatā€™s some formula, but it works. Iā€™m not too happy about the speed though, letā€™s adjust that. Iā€™ll use a cutoff of 55, which gives me a speed of 12 and an offset of 660.

$(#DWFSS#-(60*(floor(#Ds#/10))))>=55?((60*(floor(#Ds#/10)))-660)+((#DWFSS#-(60*(floor(#Ds#/10))))*12):(60*(floor(#Ds#/10)))$

Nice.

The problem right now is that I can only sync it to rotate a full turn every minute. I suspect this is due to using #DWFSS# without alteration and that I could probably get it to work differently by tweaking that part. But perhaps thatā€™s not a huge problem for most people.

Happy watchmaking!

EDIT: Hereā€™s a proof of conceptā€¦

1 Like

What a great new tick Version. Something in the middle between #DWFSS# and #DWFS#.

This one is interesting, too:

$(#DWFSS#-#DWFS#)>=5?#DWFSS#:#DWFS#$

Great work!

I think I am getting there @Tomas. I found an expression from @Mellin for calculating the modulas. I switched up my goal slightly to fit the design Iā€™m now working on:


Instead of 6 stopping points there are only 5. The slider will start at the bottom left and move around using the following:
(-135+(((floor(#DWE#))-((floor(#DWE#/5))*5))*67.5))

Currently it is a hard movement with no animation in between, but I plan on continuing to try and work in the interpAccel function to get some movement out of it.

1 Like

Nice design and effect combination @eradicator09! Compliment.

From the expression point of view its getting harder and harderā€¦ :wink: If I would like to have such moving elements I would go for time effective

A - simple sin (cos) movement function (0+(135 * (-cos(((#DWE# * 0.1)-(floor(#DWE# * 0.1))) * 2 * pi))))

or

B - splitting every position into two or more separated movements and just adjust them to see it as a nice smooth complex animation at the end

However, your attitude (C) to solve everything in only one expression it the most beautiful one.

Iā€™ve been thinking about option B as well. Have one for a static stop, then the second for the movement. Iā€™m sure Iā€™ll solve it eventually. Going to keep designing and come back to the movement a little later.

@szandor Thank you for this, I was just wondering how to rotate my second hand by 30Ā° every 5sec and I used your solution with some different parameter:

$(#DWFSS#-(30*(floor(#Ds#/5))))>=25?((30*(floor(#Ds#/5)))-150)+((#DWFSS#-(30*(floor(#Ds#/5))))*6):(30*(floor(#Ds#/5)))$

Nowā€¦ all this works nice on creator, but does not work correctly on watch.
Any idea? :thinking:

No input from me on this as of yet, but this is a great thread, very informative.

How sensitive is watch to assumed syntax? eg. missing '*'s, extra/missing brackets ā€˜()ā€™

$(#DWFSS#-(30*(floor(#Ds#/5))))>=25?((30*(floor(#Ds#/5)))-150)+((#DWFSS#-(30*(floor(#Ds#/5))))6):(30(floor(#Ds#/5)))$

vs.

$(#DWFSS#-30*floor(#Ds#/5))>=25?(30*floor(#Ds#/5)-150+(#DWFSS#-30*floor(#Ds#/5))*6):(30*floor(#Ds#/5))$

1 Like

Thank you @andrew.dowden.
I donā€™t know why, but there was no missing ā€œ*ā€ in the real formula, only here. The problem, as you teach me, was the brackets, unneeded brackets can break functionality on watch.
Thank you again :slight_smile:

1 Like

FYI ā€¦

If you go back and edit your earlier post. Highlight the formula and select ā€˜Preformatted Textā€™ (or <Ctrl>-<Shift>-<C>). It should then show all ā€˜*ā€™ and other characters.

Wow, it worked! :wink: Thank you for this tip!

1 Like