Input: one of the bars pivoted on the grey base.
Length of the vertical bars (grey, yellow and brown): a
Length of blue bar: a
Length of green bars: 0.4a + 0.6a
Length of orange bars: 0.4a
Distance between two holes of violet bars: 0.4a. They have grooves, in which a pin of the pink slider moves.
Output: the brown end bar that translates along an absolutely straight line and is kept always parallel to the grey base.
The gravity tends to keep the mechanism at a stretching position.