Skip to content

Commit

Permalink
feat(ru): update "SVG fill-rule" translation (#16926)
Browse files Browse the repository at this point in the history
Co-authored-by: A1lo <[email protected]>
  • Loading branch information
leon-win and yin1999 committed Nov 16, 2023
1 parent 7ae6424 commit c7ae743
Showing 1 changed file with 62 additions and 45 deletions.
107 changes: 62 additions & 45 deletions files/ru/web/svg/attribute/fill-rule/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ slug: Web/SVG/Attribute/fill-rule

{{SVGRef}}

The **`fill-rule`** этот атрибут представления, формулирует алгоритм, используемый для определения внутренней части фигуры.
Атрибут `fill-rule` указывает алгоритм, используемый для определения внутренней части фигуры.

> **Примечание:** Атрибут представления, `fill-rule` может быть использован как CSS-свойство.
> **Примечание:** Как атрибут представления, `fill-rule` можно использовать в качестве CSS-свойства.
Как атрибут представления, он может быть применён к следующим восьми элементам:: {{SVGElement('altGlyph')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tref')}}, and {{SVGElement('tspan')}}
Этот атрибут может быть применён к следующим SVG элементам:

- {{SVGElement('path')}}
- {{SVGElement('polygon')}}
- {{SVGElement('polyline')}}
- {{SVGElement('text')}}
- {{SVGElement('textPath')}}
- {{SVGElement('tref')}}
- {{SVGElement('tspan')}}

## Пример

```css hidden
html,
Expand All @@ -21,17 +31,14 @@ svg {

```html
<svg viewBox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg">
<!-- Default value for fill-rule -->
<!-- Значение по умолчанию для свойства `fill-rule` -->
<polygon
fill-rule="nonzero"
stroke="red"
points="50,0 21,90 98,35 2,35 79,90" />

<!--
The center of the shape has two
path segments (shown by the red stroke)
between it and infinity. It is therefore
considered outside the shape, and not filled.
Центральная часть считается не входящей в фигуру и поэтому не заполняется цветом
-->
<polygon
fill-rule="evenodd"
Expand All @@ -40,22 +47,34 @@ svg {
</svg>
```

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

## Примечания по использованию

| Значение | `nonzero` \| `evenodd` |
| --------------------- | ---------------------- |
| Значение по умолчанию | `nonzero` |
| Анимируемый | Да |

The `fill-rule` attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined:
<table class="properties">
<tbody>
<tr>
<th scope="row">Значение</th>
<td><code>nonzero</code> | <code>evenodd</code></td>
</tr>
<tr>
<th scope="row">Значение по умолчанию</th>
<td><code>nonzero</code></td>
</tr>
<tr>
<th scope="row">Поддержка анимации</th>
<td>discrete</td>
</tr>
</tbody>
</table>

Атрибут `fill-rule` предоставляет два варианта определения внутренней части фигуры (то есть области, подлежащей заливке):

### nonzero

The value `nonzero` determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray. Starting with a count of zero, add one each time a path segment crosses the ray from left to right and subtract one each time a path segment crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the path. Otherwise, it is inside.
Значение `nonzero` определяет принадлежность точки фигуры к внутренней части с помощью рисования луча от этой точки до бесконечности в любом направлении, а затем проверки мест, где сегмент фигуры пересекает луч. Начиная с нуля, каждый раз, когда луч пересекает сегмент фигуры слева направо, происходит увеличение счётчика на единицу, а когда справа налево, то уменьшение. Если после подсчёта пересечений результат равен нулю, то точка находится за пределами фигуры, в противном случае — внутри.

#### Example
#### Пример

```css hidden
html,
Expand All @@ -67,43 +86,42 @@ svg {

```html
<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
<!-- Effect of nonzero fill rule on crossing path segments -->
<!-- Применение значения `nonzero` для пересекающихся частей фигуры -->
<polygon
fill-rule="nonzero"
stroke="red"
points="50,0 21,90 98,35 2,35 79,90" />

<!--
Effect of nonzero fill rule on a shape inside a shape
with the path segment moving in the same direction
(both squares drawn clockwise, to the "right")
Применение значения `nonzero` для фигуры, находящейся внутри
другой фигуры (два квадрата, сегменты которых составлены из точек,
расположенных в одном направлении — по часовой стрелке)
-->
<path
fill-rule="nonzero"
stroke="red"
d="M110,0 h90 v90 h-90 z
M130,20 h50 v50 h-50 z" />
d="M110,0 h90 v90 h-90 z M130,20 h50 v50 h-50 z" />

<!--
Effect of nonzero fill rule on a shape inside a shape
with the path segment moving in the opposite direction
(one square drawn clockwise, the other anti-clockwise)
Применение значения `nonzero` для фигуры, находящейся внутри
другой фигуры (два квадрата, сегменты которых составлены из точек,
расположенных в противоположных направлениях: у одного квадрата по
часовой стрелке, у второго — против)
-->
<path
fill-rule="nonzero"
stroke="red"
d="M210,0 h90 v90 h-90 z
M230,20 v50 h50 v-50 z" />
d="M210,0 h90 v90 h-90 z M230,20 v50 h50 v-50 z" />
</svg>
```

{{EmbedLiveSample('nonzero', '100%', 200)}}

### evenodd

The value `evenodd` determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.
Значение `evenodd` определяет принадлежность точки фигуры к внутренней части с помощью рисования луча от этой точки до бесконечности в любом направлении и подсчёта количества сегментов фигуры, которые этот луч пересекает. Если это число нечётное, точка находится внутри, если чётное, то точка снаружи.

#### Example
#### Пример

```css hidden
html,
Expand All @@ -115,42 +133,41 @@ svg {

```html
<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
<!-- Effect of evenodd fill rule on crossing path segments -->
<!-- Применение значения `evenodd` для пересекающихся частей фигуры -->
<polygon
fill-rule="evenodd"
stroke="red"
points="50,0 21,90 98,35 2,35 79,90" />

<!--
Effect of evenodd fill rule on on a shape inside a shape
with the path segment moving in the same direction
(both squares drawn clockwise, to the "right")
Применение значения `evenodd` для фигуры, находящейся внутри
другой фигуры (два квадрата, сегменты которых составлены из точек,
расположенных в одном направлении — по часовой стрелке)
-->
<path
fill-rule="evenodd"
stroke="red"
d="M110,0 h90 v90 h-90 z
M130,20 h50 v50 h-50 z" />
d="M110,0 h90 v90 h-90 z M130,20 h50 v50 h-50 z" />

<!--
Effect of evenodd fill rule on a shape inside a shape
with the path segment moving in opposite direction
(one square drawn clockwise, the other anti-clockwise)
Применение значения `evenodd` для фигуры, находящейся внутри
другой фигуры (два квадрата, сегменты которых составлены из точек,
расположенных в противоположных направлениях: у одного квадрата по
часовой стрелке, у второго — против)
-->
<path
fill-rule="evenodd"
stroke="red"
d="M210,0 h90 v90 h-90 z
M230,20 v50 h50 v-50 z" />
d="M210,0 h90 v90 h-90 z M230,20 v50 h50 v-50 z" />
</svg>
```

{{EmbedLiveSample('evenodd', '100%', 200)}}

## Browser compatibility
## Спецификации

{{Compat}}
{{Specifications}}

## Specification
## Совместимость с браузерами

{{Specifications}}
{{Compat}}

0 comments on commit c7ae743

Please sign in to comment.