有什么方法可以使用 SVG 中的一条线连接两个点。我有以下内容在 SVG 中创建点。
<?xml version="1.0" standalone="no"?>
<svg width="200px" height="200px" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M10 10"/>
<!-- Points -->
<circle cx="10" cy="10" r="2" fill="red"/>
<circle cx="90" cy="90" r="2" fill="red"/>
<circle cx="90" cy="10" r="2" fill="red"/>
<circle cx="10" cy="90" r="2" fill="red"/>
</svg>
我需要使用 jquery 函数在点之间画一条线。
最佳答案
您可以使用一行:
<line x1="10" y1="10" x2="90" y2="90" stroke-width="1" stroke="black"/>
或者一条路径:
<path d="M10 10 90 90" stroke-width="1" stroke="black"/>
为什么需要jQuery?
关于SVG用一条线连接两点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17272907/