Click on the example window to add points. You can move them by dragging, and remove them pressing supr or backspace.
This block is a Canvas version of the Spline Editor by Mike Bostock. To get all the parts together, I read these two nice tutorials: Working with D3.js and Canvas: When and How by [Irene Ros] and (https://bocoup.com/about/bocouper/irene-ros) and D3 and Canvas in 3 steps by lars verspohl. The first one covers the use of D3 with canvas maintaining the enter/update/remove pattern, and the second, the selection of the elements on the canvas.
https://d3js.org/d3.v4.min.js