gpt4 book ai didi

SVG用一条线连接两点

转载 作者:行者123 更新时间:2023-12-04 23:25:31 25 4
gpt4 key购买 nike

有什么方法可以使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com