Look into something like this:
You need to get the position of each element with a function that’s called every time you move anything. But… that’s a shipload of state management. Also… I’m not really sure how you should go about drawing the lines.
Typically, you’d use canvas for something like this. But… it looks like you’re trying to do some straight up DOM action. I would recommend this:
In theory, you should be able to pass your coordinates to some function that handles the drawing of these svg lines.
Hey, is there any way you could make this your Gravatar: