Normally I’d break out the technic lego to design these sort of things…
(I didn’t make this!)
https://www.youtube.com/watch?v=rShllGfOrqM
It was designed in Linkage
https://www.youtube.com/watch?v=O5IqIGtqKDk
Neat free software!
http://blog.rectorsquid.com/linkage-mechanism-designer-and-simulator/