gpt4 book ai didi

css - 如何使用单路径绘制 flex 的 SVG?

转载 作者:行者123 更新时间:2023-11-28 08:50:25 25 4
gpt4 key购买 nike

我想要的是下图 - enter image description here

I have 3 relative question regarding this

1.我们可以用单一路径绘制整个 Canvas 吗?

2.如果我们只能用一条以上的路径画出整体,方便给它们做动画吗?

3.在这两种情况下,任何人都可以通过示例指导正确的方法吗?

这就是我到目前为止的进展...如您所见,我不是 SVG 方面的专家,当然,您可以使用圆圈作为大点。提前谢谢你。

svg {
width: 100%;
}

.straightLine {
height: 3000px;
position: relative;
}

.st0 {
fill: none;
stroke-dashoffset: 3px;
stroke: #000000;
stroke-width: 5;
stroke-miterlimit: 10;
}
<div class="straightLine">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1280 1000" style="enable-background:new 0 0 1280 800;" xml:space="preserve">
<g class="all">
<path id="line1" class="st0" stroke-dasharray="10,9" d="M 35 -17 C 0 190 50 83 600 109 "/>
<path id="line1" class="st0" stroke-dasharray="10,9" d="M 600 109 c 64.9 0 90.4 40.5 90.4 90.4"/>
</g>
</svg>
</div>

最佳答案

使用类似的东西:

<path d="M 20 0 v 20 a 30 30 0 0 0 30 30 h 600 a 40 40 0 0 1 0 80 h -140 a 30 30 0 0 0 0 60 h 200 a 40 40 0 0 1 0 80 h -100 a 30 30 0 0 0 -30 30 v 20" />

如图the documentation , 路径可以包含任意数量的组件。

总结:

M/m    Move current position
L/l Draw a line
H/h Draw a horizontal line
V/v Draw a vertical line
C/c Draw a cubic Bezier
Q/q Draw a quadratic Bezier
A/a Draw a circular/elliptal arc
Z/z Close path

一般情况下,大写指令指定绝对坐标,小写指令指定相对坐标。

关于css - 如何使用单路径绘制 flex 的 SVG?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45483958/

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