Unfortunately, it is faster to calculate them manually. The function for calculating bezier curves is difficult from the Math side. And in this example, I tried to show the principe of drawing. Here you can https://javascript.info/bezier-curve the explanation behind coordinates and the ways how to manipulate these curves.(I used this site for understanding how to manualy choose coordinates). Hope it will help you!