Rolling Rod of Spur Gears

Input: yellow bar.
All the gears have the same tooth number.
Blue gears rotate idly on yellow or pink bars.
The gears are fixed to the bar of their colour.
Grey gear is fixed to the grey base.
Angles between adjacent bars are kept equal to the input angle A during the motion.
If A = 120 deg., the three bars create an equilateral triangle.
If the bar number is n, the bars can create an equilateral polygon of n sides when A = 360/n.
Instead of spur gears other drive can be used provided that transmission ratio between grey and pink gears / yellow and green gears is -1.