-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathgeometry.html
414 lines (382 loc) · 12.4 KB
/
geometry.html
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional+edit//EN" "xhtml1-transitional+edit.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:edit="http://xmlns.grorg.org/SVGT12NG/">
<head>
<title>Geometry Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<!-- Style sheets for local dev. Will be standardized in processing.
Add attribute data-keep="" to any extra stylesheet link you do not want removed
(or use <style>), and include it before here. -->
<link rel="stylesheet" href="style/svg.css" type="text/css" />
<link rel="stylesheet" href="style/W3C-ED.css" type="text/css" />
</head>
<body class="ready-for-wider-review">
<h1>Geometry Properties</h1>
<p>Beside SVG's styling properties, SVG also defines
<dfn id='geometry-properties' data-dfn-type="dfn" data-export="">geometry properties</dfn>. Geometry properties
describe the position and dimension of the <a>graphics element</a>s <a>'circle'</a>,
<a>'ellipse'</a>, <a>'rect'</a>, <a>'image'</a>, <a>'foreignObject'</a> and the
<a>'svg'</a> element.</p>
<h2 id='CX'>Horizontal center coordinate: The
<span class="property">'cx'</span> property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="CxProperty" data-dfn-type="property" data-export="">cx</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'circle'</a> and <a>'ellipse'</a> elements
</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the width of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'cx'</a> property describes the horizontal center coordinate
of the position of the element.</p>
<h2 id='CY'>Vertical center coordinate: The <span class="property">'cy'</span>
property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="CyProperty" data-dfn-type="property" data-export="">cy</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'circle'</a> and <a>'ellipse'</a> elements
</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the height of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'cy'</a> property describes the vertical center coordinate
of the position of the element. </p>
<h2 id='R'>Radius: The <span class="property">'r'</span> property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="RProperty" data-dfn-type="property" data-export="">r</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'circle'</a> element</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the normalized diagonal of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'r'</a> property describes the radius of the <a>'circle'</a>
element.</p>
<p>A negative value for <a>'r'</a> is <a>invalid</a> and must be <a>ignored</a>.</p>
<h2 id='RX'>Horizontal radius: The <span class="property">'rx'</span>
property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="RxProperty" data-dfn-type="property" data-export="">rx</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a> | auto</td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'ellipse'</a>, <a>'rect'</a> elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the width of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'rx'</a> property describes the horizontal radius of the
<a>'ellipse'</a> element and the curve radius of the <a>'rect'</a>
element.
When the computed value of <span class="property">'rx'</span> is <span class="prop-value">auto</span>, the used radius is equal to the absolute length used for <a>'ry'</a>, creating a circular arc.
If both <span class="property">'rx'</span> and <span class="property">'ry'</span> have a computed value of <span class="prop-value">auto</span>, the used value is 0.
</p>
<p> Regardless of how the value is calculated, the used value of <span class="property">'rx'</span> for a <a>'rect'</a> is never more than 50% of the used value of <a>'width'</a> for the same shape.
</p>
<p class="note">
The <span class="prop-value">auto</span> behavior is new in SVG 2 for <a>'ellipse'</a>,
matching the behavior for <a>'rect'</a> elements when <a>'rx'</a> was not specified.
</p>
<p>A negative value for <a>'rx'</a> is <a>invalid</a> and must be <a>ignored</a>.</p>
<h2 id='RY'>Vertical radius: The <span class="property">'ry'</span>
property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="RyProperty" data-dfn-type="property" data-export="">ry</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a> | auto</td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'ellipse'</a>, <a>'rect'</a></td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the height of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th>Animatable type:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'ry'</a> property describes the vertical radius of the
<a>'ellipse'</a> element and the vertical curve radius of the <a>'rect'</a>
element.
When the computed value of <span class="property">'ry'</span> is <span class="prop-value">auto</span>, the used radius is equal to the absolute length used for <a>'rx'</a>, creating a circular arc.
If both <span class="property">'rx'</span> and <span class="property">'ry'</span> have a computed value of <span class="prop-value">auto</span>, the used value is 0.
</p>
<p> Regardless of how the value is calculated, the used value of <span class="property">'ry'</span> for a <a>'rect'</a> is never more than 50% of the used value of <a>'height'</a> for the same shape.
</p>
<p class="note">
The <span class="prop-value">auto</span> behavior is new in SVG 2 for <a>'ellipse'</a>,
matching the behavior for <a>'rect'</a> elements when <a>'ry'</a> was not specified.
</p>
<p>A negative value for <a>'ry'</a> is <a>invalid</a> and must be <a>ignored</a>.</p>
<h2 id='X'>Horizontal coordinate: The <span class="property">'x'</span> property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="XProperty" data-dfn-type="property" data-export="">x</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'svg'</a>, <a>'rect'</a>,
<a>'image'</a>, <a>'foreignObject'</a> elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the width of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'x'</a> property describes the horizontal coordinate of
the position of the element.</p>
<h2 id='Y'>Vertical coordinate: The <span class="property">'y'</span>
property</h2>
<table class="propdef def">
<tr>
<th>Name:</th>
<td><dfn id="YProperty" data-dfn-type="property" data-export="">y</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><a><length-percentage></a></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td><a>'svg'</a>, <a>'rect'</a>,
<a>'image'</a>, <a>'foreignObject'</a> elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>refer to the height of the current SVG viewport (see
<a href="coords.html#Units">Units</a>)</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>an absolute length or percentage</td>
</tr>
<tr>
<th><a>Animation type</a>:</th>
<td>by computed value</td>
</tr>
</table>
<p>The <a>'y'</a> property describes the vertical coordinate of
the position of the element.</p>
<h2 id="Sizing">Sizing properties: the effect of the
<span class='property'>'width'</span> and <span class='property'>'height'</span>
properties</h2>
<p class='note'>See the CSS 2.1 specification for the definitions of
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-width"><span class="prop-name">width</span></a> and
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-height"><span class="prop-name">height</span></a>.</p>
<p>The CSS <a>'width'</a> and <a>'height'</a> properties are used for
sizing some SVG elements. Specifically, they are used to size
<a>'rect'</a>, <a>'svg'</a>, <a>'image'</a> and
<a>'foreignObject'</a>. All of these elements have <span class='attr-name'>'width'</span>
and <span class='attr-name'>'height'</span> presentation attributes.
The properties are also used for laying out embedded elements from the HTML namespace.
</p>
<p>The used value of <a>'width'</a>
may be constrained by the value of the
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-max-width"><span class="prop-name">max-width</span></a> and
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-max-width"><span class="prop-name">min-width</span></a> properties.
The used value of <a>'height'</a>
may be constrained by the value of the
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-max-height"><span class="prop-name">max-height</span></a> and
<a href="https://www.w3.org/TR/CSS21/visudet.html#propdef-max-height"><span class="prop-name">min-height</span></a> properties.
</p>
<p>The value <span class='prop-value'>auto</span> for <a>'width'</a>
and <a>'height'</a> on the <a>'svg'</a> element is treated as 100%.</p>
<p>The value <span class='prop-value'>auto</span> for <a>'width'</a>
and <a>'height'</a> on the <a>'image'</a> element is calculated from the referenced image's intrinsic dimensions and aspect ratio, according to the CSS <a>Default Sizing Algorithm</a>.</p>
<p class="note">
New in SVG 2. Images embedded in SVG can now be auto-sized to the intrinsic size, or scaled to a fixed height or width according to the intrinsic aspect ratio. This matches the behavior of embedded images in HTML.
</p>
<p>The value <span class='prop-value'>auto</span> for <a>'width'</a>
and <a>'height'</a> on other elements is treated as 0.</p>
<p class='note'>This means that, for example, a <a>'foreignObject'</a>
object element will not shrink-wrap to its contents if
<span class='prop-value'>auto</span> is used.</p>
</body>
</html>