I have always found the presentation of meshing cogs to be very crude.

This is my crude composition: https://shared.xara.com/Wh8EchMk7R

I tried with Xara's starred curved shapes to get the timing right.
I then created a cog as a Scatter Brush.

The animation script is very simple.

I extruded two cogs and got rotating cupcakes!

Acorn