In this post, I will explain How to Scotch-yoke mechanism work? It converts rotary to linear motion. Red link is drive,rotates, Yellow pin will slide on the yoke. This causes the green link (attached sliding bar) to reciprocate, tracing a sinusoidal waveform.
You can see this video below for more understanding.