ideas for creating linear movement/ general suggestions for approach please

A cam - like in an internal combustion engine - the thing that lifts the valves.