如何使用单路径绘制 SVG 曲线?

weB*_*Ber 6 css svg svg-animate

我想要的是下图- 在此处输入图片说明

我对此有 3 个相关问题

1.我们可以用single path.绘制整个画布吗?

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;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)

Phy*_*sis 2

使用类似的东西:

<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" />
Run Code Online (Sandbox Code Playgroud)

如文档中所示,路径可以包含任意数量的组件。

总结一下:

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
Run Code Online (Sandbox Code Playgroud)

一般来说,大写指令指定绝对坐标,小写指令指定相对坐标。