Sven pegels
Sven pegels

Reputation: 65

Path/line with angled end/linecap

I am trying to create a shape like the white shape in the attached image. Would it be possible to achieve this with a single line from A to B, and somehow giving the ends an angle? Or would the easiest solution be to use a path to trace the sides and fill the shape?

Line with angled end

Upvotes: 1

Views: 334

Answers (1)

Robert Longson
Robert Longson

Reputation: 124179

A skew transform will do that to a straight line.

html, body {
  width: 100%;
  height: 100%;
}
<svg width="100%" height="100%">
  <line stroke-width="5" stroke="red" transform="scale(3) translate(35,3) skewX(-30)" y2="50"/>
</svg>

Upvotes: 4

Related Questions