# how do I animate a geneva drive with animation nodes?

I did this geneva drive but I don't know how to animate it Simply dividing by 6 don't work because the second gear should only moves at a certain time. I already tried some equations but none of them worked.

edit: It is going to be part of a big gear system, so the second gear's rotation cannot reset, it needs to increase continuously.

Here my solution: 1. First, I use modulo to get 360-rotation cycle.
2. Next I divide degrees to get 0-1 range.
3. When I use Curve interpolation to mach each cycle with rotation of secondary object. (Curve is drawn by hand)
4. Finally, get back to degrees with some scale (6 times smaller) Note, that i'm don't care about real 360-degree rotation of secondary shape. It rotates in 0-60 degree range. If you want to get real rotation, you need to add each cycle to the result.

UPD:

It works for this example where there is only those two gears, but not for what I need because it will control a whole clock gear system, so the second gear can't have its rotation being reseted

As I noted, If you want to get real rotation, you need to add each cycle to the result: To get cycle number you need to divide rotation by 360, and convert result to integer using Floor function. When just multiply it by same number, -60 and add it to rotation

• It works for this example where there is only those two gears, but not for what I need because it will control a whole clock gear system, so the second gear can't have its rotation being reseted. – Diogo Valadares Nov 19 '18 at 15:30

So, I found a way to do it.

First of all you create a reference object where you are going to add a Fcurve. It can be a bone or an empty.

Then insert keyframes in the rotation of one of the axes. It will probably create keyframes in all axes, so just delete 2 of them.

After you need to insert keyframes in the frames -5,35 and 55 with the last with -60° value and then add a cycles modifies.

You will get something like this: In the end you just need to make this setup here: If you want to make it and the gear has more or less steps, you just need to change the Fcurve scale.