When using the SVG API, I can create a line going from point (x1,y1)
to (x2,y2)
. I may be doing this because (x1,y1)
corresponds to the place where I have an object A
and (x2,y2)
to a place where there's an object B
.
It may happen that during an animation I then move object A
to a different place. The problem is that then the line drawn between A
and B
will not get automatically updated.
I would like to know if there is a way through SVG, JS, or some existing library, to be able to express that a given line should connect object A
and B
, and if I move them around, the line should automatically get updated.
This is not really tied only to animations -- I may want to put a bunch of objects in some set of positions and it's just easier to say that I want to connect A
to B
than having to repeat the coordinates around.
Of course, the line here was just an example, I'd be looking to be able to do this for a whole range of other cases.
Thanks