Gear Whiplash

Input: pink gear crank.
System of gears and bars stretches and folds continuously when the input rotates.
White gear is stationary.
Blue gears are in mesh with white and green gears.
Pink gear is in mesh with yellow gear.
The stretching length can be increased by adding the gear-bars.
At particular positions various regular polygons are created (triangular and square in this video).
Green curve is the trajectory of a point on the green bar.
Instead of gear drives use cross belt or bevel gear ones to make the system less bulky.