Skip to content

Commit

Permalink
[ru]: fix MacroLiveSampleError on docs/Web/SVG/Attribute/stroke-dasho…
Browse files Browse the repository at this point in the history
…ffset (mdn#12578)
  • Loading branch information
leon-win committed Nov 13, 2023
1 parent 2491e18 commit 4822ce0
Showing 1 changed file with 8 additions and 106 deletions.
114 changes: 8 additions & 106 deletions files/ru/web/svg/attribute/stroke-dashoffset/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ slug: Web/SVG/Attribute/stroke-dashoffset
Как атрибут представления, он может применяться к любому элементу, но влияет только на следующие одиннадцать элементов: {{SVGElement('altGlyph')}}, {{SVGElement('circle')}}, {{SVGElement('ellipse')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tref')}}, and {{SVGElement('tspan')}}

## Пример

```css hidden
html,
body,
Expand Down Expand Up @@ -75,116 +77,16 @@ svg {
</svg>
```

{{EmbedLiveSample('topExample', '100%', 200)}}
{{EmbedLiveSample("Пример", '100%', 200)}}

## Usage context

| Категория | Атрибут оформления |
| ----------------- | ------------------------------------------------------------------------------------------------------- |
| Категория | Атрибут оформления |
| ----------------- | ----------------------------------------------------------------------------------------------------- |
| Значение | [\<percentage>](/en-US/docs/Web/SVG#percentage) \| [\<length>](/en-US/docs/Web/SVG#length) \| inherit |
| Исходное значение | 0 |
| Анимируемый | Да |
| Спецификация | [SVG 1.1 (2nd Edition)](https://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty) |

## Пример

### HTML

```html
<?xml version="1.0"?>
<svg
width="200"
height="230"
viewBox="0 0 200 200"
version="1.1"
xmlns="http://www.w3.org/2000/svg">
<line stroke-dasharray="20, 5" x1="10" y1="10" x2="190" y2="10" />
<!--
Поскольку размер штриха 20 с разрывами 5,
добавление смещения dash-offset 20 приводит к тому,
что линия начинается с разрыва.
-->
<line
stroke-dashoffset="20"
stroke-dasharray="20, 5"
x1="10"
y1="30"
x2="190"
y2="30" />
<!--
Добавление смещения штрихов на 10% приводит к началу линии с разрывом там же,
потому что элемент svg имеет ширину области просмотра 200.
Меняя размер svg, меняется и значение в пикселях stroke-dashoffset.
-->
<line
stroke-dashoffset="10%"
stroke-dasharray="20, 5"
x1="10"
y1="50"
x2="190"
y2="50" />
<line
stroke-dashoffset="10"
stroke-dasharray="20, 5"
x1="10"
y1="70"
x2="190"
y2="70" />

<line
stroke-dashoffset="100"
stroke-dasharray="200"
x1="10"
y1="90"
x2="190"
y2="90" />
<line
stroke-dashoffset="100"
stroke-dasharray="100"
x1="10"
y1="110"
x2="190"
y2="110" />
<!--
Без stroke-dasharray - stroke-dashoffset не даст никакого эффекта.
-->
<line stroke-dashoffset="50" x1="10" y1="130" x2="190" y2="130" />
<!--
stroke-dashoffset values can be negative and as expected offest
in the opposite direction as a positive value.
Значения смещения штрихов могут быть отрицательными
с направлением, обратным положительному значению.
-->
<line
stroke-dashoffset="-40"
stroke-dasharray="80"
x1="10"
y1="150"
x2="190"
y2="150" />
<line stroke-dasharray="80" x1="10" y1="170" x2="190" y2="170" />
<line
stroke-dashoffset="-10%"
stroke-dasharray="65, 5, 1, 5"
x1="10"
y1="190"
x2="190"
y2="190" />
<line stroke-dasharray="65, 5, 1, 5" x1="10" y1="210" x2="190" y2="210" />
<style>
<![CDATA[
line{
stroke: black;
stroke-width: 2;
}
]]>
</style>
</svg>
```
### Результат
{{EmbedLiveSample('Пример', '220', '240')}}
| Исходное значение | 0 |
| Анимируемый | Да |
| Спецификация | [SVG 1.1 (2nd Edition)](https://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty) |

## Элементы

Expand Down

0 comments on commit 4822ce0

Please sign in to comment.