stroke-linejoin
Атрибут stroke-linejoin — это атрибут представления, определяющий форму, используемую в углах путей при их обводке.
Примечание: В качестве атрибута представления stroke-linejoin можно использовать как свойство CSS.
Вы можете использовать этот атрибут с следующими элементами SVG:
Пример
<svg viewBox="0 0 18 12" xmlns="http://www.w3.org/2000/svg"> <!-- Upper left path: Effect of the "miter" value --> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- Center path: Effect of the "round" value --> <path d="M7,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="round" /> <!-- Upper right path: Effect of the "bevel" value --> <path d="M13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- Bottom left path: Effect of the "miter-clip" value with fallback to "miter" if not supported. --> <path d="M3,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- Bottom right path: Effect of the "arcs" value with fallback to "miter" if not supported. --> <path d="M9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="highlight"> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5.5" r="0.05" fill="pink" /> </g> <use href="#highlight" x="6" /> <use href="#highlight" x="12" /> <use href="#highlight" x="2" y="6" /> <use href="#highlight" x="8" y="6" /> </svg>
Контекст использования
| Значение | arcs | bevel |miter | miter-clip | round |
|---|---|
| Значение по умолчанию | miter |
| Анимируемо | дискретно |
дуги
Примечание: Значение arcs было добавлено в SVG2 и пока не поддерживается широко, см. совместимость с браузерами ниже для получения дополнительной информации.
Значение arcs указывает, что для соединения сегментов пути следует использовать угол дуги. Форма дуги формируется путем продолжения внешних границ обводки в точке соединения дугами, имеющими одинаковую кривизну с внешними границами в точке соединения.
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "arcs" value --> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="p"> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> </g> </svg>
фаска
Значение bevel указывает, что для соединения сегментов пути следует использовать фаску.
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "bevel" value --> <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="p"> <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> </g> </svg>
срез
Значение miter указывает, что для соединения сегментов пути следует использовать острый угол. Угол формируется путем продолжения внешних границ обводки по касательным сегментам пути до пересечения.
Примечание: Если предел stroke-miterlimit превышен, соединение линий переходит к значению bevel.
<svg viewBox="0 -1 10 7" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "miter" value --> <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- Effect of the "miter" value on a sharp angle where de default miter limit is exceeded --> <path d="M7,5 l0.75,-3 l0.75,3" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- the following red dotted line show where the miter value falls back to the bevel value --> <path d="M0,0 h10" stroke="red" stroke-dasharray="0.05" stroke-width="0.025" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g> <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> <path d="M7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="7" cy="5" r="0.05" fill="pink" /> <circle cx="7.75" cy="2" r="0.05" fill="pink" /> <circle cx="8.5" cy="5" r="0.05" fill="pink" /> </g> </svg>
срез с обрезкой
Примечание: Значение miter-clip было добавлено в SVG2 и пока не поддерживается широко, см. совместимость с браузерами ниже для получения дополнительной информации.
Значение miter-clip указывает, что для соединения сегментов пути следует использовать острый угол. Угол формируется путем продолжения внешних границ обводки по касательным сегментам пути до пересечения.
Если предел stroke-miterlimit превышен, срез усекается на расстоянии, равном половине значения stroke-miterlimit умноженного на ширину обводки от точки пересечения сегментов пути. Это обеспечивает более качественное отображение, чем miter при очень острых соединениях или при анимации.
<svg viewBox="0 -1 10 7" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "miter-clip" value --> <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- Effect of the "miter-clip" value on a sharp angle where de default miter limit is exceeded --> <path d="M7,5 l0.75,-3 l0.75,3" stroke="black" fill="none" stroke-linejoin="miter-clip" /> <!-- the following red dotted line show where the clip should happen --> <path d="M0,0 h10" stroke="red" stroke-dasharray="0.05" stroke-width="0.025" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g> <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> <path d="M7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="7" cy="5" r="0.05" fill="pink" /> <circle cx="7.75" cy="2" r="0.05" fill="pink" /> <circle cx="8.5" cy="5" r="0.05" fill="pink" /> </g> </svg>
круглый
Значение round указывает, что для соединения сегментов пути следует использовать закругленный угол.
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- Effect of the "round" value --> <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none" stroke-linejoin="round" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="p"> <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5" r="0.05" fill="pink" /> </g> </svg>
Спецификации
| Спецификация |
|---|
| Scalable Vector Graphics (SVG) 2 # LineJoin |
Совместимость с браузерами
| Рабочий стол | Мобильные устройства | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox для Android | Opera Android | Safari на IOS | Samsung Internet | WebView Android | |
stroke-linejoin |
≤80 | 80 | ≤72 | 67 | ≤13.1 | 80 | 79 | 57 | ≤13.4 | 13.0 | 80 |
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linejoin