Mechanism design and linkage synthesis is interrelated to each other. While kinematic analysis of any mechanism is done with the known math tools. However the inverse is quite complex.
For a given/designed mechanism, it is pretty easy to generate the motion of the mechanism, as the fundamental principles are taught to mechanical engineering junior students. However it is not taught how to design a mechanism that draw a specific motion.
You can design any 2D mechanism in order to follow such a specific trajectory, with this application: MotionGen (https://www.stonybrook.edu/commcms/motiongen/index.php) . The application was created by Anurag Purwar (Stony Brook University). Here is short demonstration he presented:
The theory behind the MotionGen app is presented here in this video: