6

How can I draw this shape using a single svg path?

enter image description here

abhishek khandait
  • 1,990
  • 2
  • 15
  • 18

1 Answers1

7

You can do it with a single path, but currently there's no such thing as variable width stroke. Instead, such a shape can be drawn using fill on a path criss-crossing itself:

#hide-stroke:checked ~ svg path {
  stroke: none;
}

svg {
  display: block;
}
<input id="hide-stroke" type="checkbox" />
<label for="hide-stroke">Hide stroke</label>

<svg xmlns="http://www.w3.org/2000/svg" width="600" height="300" viewBox="0,0 200,100" >
   <path d="M20,80  q26,-100 53,-25  q26,75 53,0  q26,-90 53,0  q-26,-70 -45,-10  q-26,80 -70,0  q-25,-40 -37,0" 
         fill="black" stroke-width="1" stroke="limegreen" />
</svg>
Sphinxxx
  • 12,484
  • 4
  • 54
  • 84
  • I can't add an answer this question is closed. The answer is no you cannot do this in SVG as a single stroke. There is a proposal to change SVG to support it: https://www.w3.org/Graphics/SVG/WG/wiki/Proposals/Variable_width_stroke – user1529413 Jul 04 '22 at 14:50