-
Notifications
You must be signed in to change notification settings - Fork 8.1k
/
index.md
72 lines (54 loc) · 3.68 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: r
slug: Web/SVG/Attribute/r
---
{{SVGRef}}Атрибут r устанавливает значение радиуса круга.
Этот атрибут используют два элемента: {{SVGElement("circle")}}, и {{SVGElement("radialGradient")}}
## Пример
```css hidden
html,
body,
svg {
height: 100%;
}
```
```html
<svg viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
<radialGradient r="0" id="myGradient000">
<stop offset="0" stop-color="white" />
<stop offset="100%" stop-color="black" />
</radialGradient>
<radialGradient r="50%" id="myGradient050">
<stop offset="0" stop-color="white" />
<stop offset="100%" stop-color="black" />
</radialGradient>
<radialGradient r="100%" id="myGradient100">
<stop offset="0" stop-color="white" />
<stop offset="100%" stop-color="black" />
</radialGradient>
<circle cx="50" cy="50" r="0" />
<circle cx="150" cy="50" r="25" />
<circle cx="250" cy="50" r="50" />
<rect x="20" y="120" width="60" height="60" fill="url(#myGradient000)" />
<rect x="120" y="120" width="60" height="60" fill="url(#myGradient050)" />
<rect x="220" y="120" width="60" height="60" fill="url(#myGradient100)" />
</svg>
```
{{EmbedLiveSample("Пример", '100%', 200)}}
## circle
Для {{SVGElement('circle')}}, `r` устанавливает радиус окружности и, следовательно, её размер. При значении, меньшем или равном нулю, круг не будет нарисован.
| Значение | **[\<length>](/docs/Web/SVG/Content_type#Length)**\| **[\<percentage>](/docs/Web/SVG/Content_type#Percentage)** |
| --------------------- | --------------------------------------------------------------------------------------------------------------- |
| Значение по умолчанию | `0` |
| Анимируемость | Да |
> [!NOTE]
> Начиная с SVG2, **r** является свойством геометрии, означающим, что этот атрибут также может использоваться как CSS-свойство для кругов.
## radialGradient
Для {{ SVGElement("radialGradient") }}, `r` устанавливает радиус конечной окружности радиального градиента.
Градиент будет нарисован таким образом, чтобы **100%** конца градиента отображались по периметру этого конечного круга. Значение, меньшее или равное нулю, приведёт к тому, что область будет окрашена как один цвет, используя цвет и непрозрачность последнего градиента {{ SVGElement("stop") }}.
| Значение | **[\<length>](/docs/Web/SVG/Content_type#Length)** \| **[\<percentage>](/docs/Web/SVG/Content_type#Percentage)** |
| --------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Значение по умолчанию | `50%` |
| Анимируемость | Да |
## Спецификации
{{Specifications}}