I'm designing a web interface for a robotic arm, and I need a way to draw lines between points in a HTML div
element, given a start (x, y)
and a end (x, y)
. I'd rather not use a canvas, because I need the lines to be elements themselves (They should have onclick
events and CSS styles). Maybe something with SVG? Note that this is different from questions like this, as that question was trying to connect elements, whereas I'm trying to connect points inside an element.
<div id="somediv">
<!--This div is 100px * 100px, I need to draw a line 4px thick from (23, 24) to (87, 96)-->
</div>
It would actually be preferable if I could create the line based on a single point and angle, but the math to convert that to two points is easy.