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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
---
title: r
slug: Web/SVG/Attribute/r
tags:
- SVG
- SVG属性
translation_of: Web/SVG/Attribute/r
---
<div>{{SVGRef}}</div>
<p><strong><code>r</code></strong> 属性用来定义圆的半径。</p>
<p>有两个元素在使用该属性:{{SVGElement("circle")}} 和 {{SVGElement("radialGradient")}}</p>
<div id="topExample">
<div class="hidden">
<pre class="brush: css">html,body,svg { height:100% }</pre>
</div>
<pre class="brush: 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></pre>
<p>{{EmbedLiveSample('topExample', '100%', 200)}}</p>
</div>
<h2 id="圆">圆</h2>
<p>对于 {{SVGElement('circle')}},<code>r</code> 用来定义圆的半径以及它的大小。取值小于或等于零,圆将不会被绘制出来。</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">值</th>
<td><strong><a href="/docs/Web/SVG/Content_type#Length"><length></a></strong> | <strong><a href="/docs/Web/SVG/Content_type#Percentage"><percentage></a></strong></td>
</tr>
<tr>
<th scope="row">默认值</th>
<td><code>0</code></td>
</tr>
<tr>
<th scope="row">可变性</th>
<td>Yes</td>
</tr>
</tbody>
</table>
<p class="note"><strong>注:</strong>起始于 SVG2,<code>r</code> 是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。</p>
<h2 id="径向渐变">径向渐变</h2>
<p>对于 {{ SVGElement("radialGradient") }},<code>r</code> 用来定义径向渐变终止圆的半径。</p>
<p>渐变将以此绘制出来:<strong>100%</strong> 渐变停止点会被映射到终止圆的一周上。取值小于或等于零,将会使用最后一个渐变 {{ SVGElement("stop") }} 的颜色和不透明度,导致该区域被绘制为单色。</p>
<table class="standard-table">
<tbody>
<tr>
<th scope="row">值</th>
<td><strong><a href="/docs/Web/SVG/Content_type#Length"><length></a></strong> | <strong><a href="/docs/Web/SVG/Content_type#Percentage"><percentage></a></strong></td>
</tr>
<tr>
<th scope="row">默认值</th>
<td><code>50%</code></td>
</tr>
<tr>
<th scope="row">可变性</th>
<td>Yes</td>
</tr>
</tbody>
</table>
<h2 id="技术规范">技术规范</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">技术规范</th>
<th scope="col">状态</th>
<th scope="col">注释</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName("SVG2", "geometry.html#R", "r")}}</td>
<td>{{Spec2("SVG2")}}</td>
<td>Definition as a geometry property</td>
</tr>
<tr>
<td>{{SpecName("SVG2", "pservers.html#RadialGradientElementRAttribute", "r")}}</td>
<td>{{Spec2("SVG2")}}</td>
<td>Definition for SVG2 paint servers <code><radialGradient></code></td>
</tr>
<tr>
<td>{{SpecName("SVG1.1", "pservers.html#RadialGradientElementRAttribute", "r")}}</td>
<td>{{Spec2("SVG1.1")}}</td>
<td>Initial definition for <code><radialGradient></code></td>
</tr>
<tr>
<td>{{SpecName("SVG1.1", "shapes.html#CircleElementRAttribute", "r")}}</td>
<td>{{Spec2("SVG1.1")}}</td>
<td>Initial definition for <code><circle></code></td>
</tr>
</tbody>
</table>
|