diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index 9e2686946754e0..64a9815ff09184 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -2492,7 +2492,6 @@ /zh-CN/docs/Web/SVG/Element/圆 /zh-CN/docs/Web/SVG/Element/circle /zh-CN/docs/Web/SVG/Element/多边形 /zh-CN/docs/Web/SVG/Element/polygon /zh-CN/docs/Web/SVG/Element/线性渐变 /zh-CN/docs/Web/SVG/Element/linearGradient -/zh-CN/docs/Web/SVG/Firefox对SVG_1.1的支持 /zh-CN/docs/Web/SVG/SVG_1.1_Support_in_Firefox /zh-CN/docs/Web/SVG/Tutorial/渐变 /zh-CN/docs/Web/SVG/Tutorial/Gradients /zh-CN/docs/Web/Security/CSP/Using_Content_Security_Policy /zh-CN/docs/Web/HTTP/CSP /zh-CN/docs/Web/Security/Securing_your_site/Configuring_server_MIME_types /zh-CN/docs/Learn/Server-side/Configuring_server_MIME_types diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index b5d74a52686667..d80462c4c8cbcf 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -44149,15 +44149,6 @@ "charlie" ] }, - "Web/SVG/SVG_1.1_Support_in_Firefox": { - "modified": "2019-03-23T22:52:10.546Z", - "contributors": [ - "Kylexii", - "sunxiang", - "ziyunfei", - "lunix01" - ] - }, "Web/SVG/SVG_animation_with_SMIL": { "modified": "2019-03-23T22:46:05.864Z", "contributors": [ diff --git a/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.html b/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.html deleted file mode 100644 index 6753d57d7a16be..00000000000000 --- a/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.html +++ /dev/null @@ -1,240 +0,0 @@ ---- -title: 在 HTML 内容中应用 SVG 效果 -slug: Web/SVG/Applying_SVG_effects_to_HTML_content -tags: - - CSS - - HTML - - SVG - - XHTML - - 指南 - - 需要示例 -translation_of: Web/SVG/Applying_SVG_effects_to_HTML_content ---- -

现代浏览器支持在 CSS 样式中使用 SVG 来对 HTML 内容应用图像效果。

- -

你可以在同一文件中使用 SVG 样式,也可以通过外部样式表引入。有三个属性可以使用: mask, clip-path, 和 filter

- -
注意: 在外部文件引入的 SVG 必须与原始文件 同源
- -

使用内嵌 SVG

- -

要想在 CSS 样式中应用 SVG 效果,首先需要创建一个引用 SVG 的 CSS 样式。

- -
<style>p { mask: url(#my-mask); }</style>
- -

在上面的例子中,所有段落会被IDmy-mask 的SVG <mask>遮罩。

- -

例子: Masking

- -

例如,你可以在你的 HTML 文档中用 SVG 和 CSS 代码对 HTML 内容作渐变 mask 效果。

- -
<svg height="0">
-  <mask id="mask-1">
-    <linearGradient id="gradient-1" y2="1">
-      <stop stop-color="white" offset="0"/>
-      <stop stop-opacity="0" offset="1"/>
-    </linearGradient>
-    <circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/>
-    <rect x="0.5" y="0.2" width="300" height="100" fill="url(#gradient-1)"/>
-  </mask>
-</svg>
-
- -
.target {
-  mask: url(#mask-1);
-}
-p {
-  width: 300px;
-  border: 1px solid #000;
-  display: inline-block;
-}
- -

注意,在 CSS 中 遮罩(mask)使用一个指向 ID 为 #mask-1的 URL,这个 ID 是在上面的 SVG 中指定的。 SVG 中其他的内容指定了渐变遮罩的细节。

- -

将 SVG 效果应用于 (X)HTML 是通过将 target 这个 class 应用于其他元素来实现的,如下所示:

- -
<p class="target" style="background:lime;">
-    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua. Ut enim ad minim veniam.
-</p>
-<p>
-    Lorem ipsum dolor sit amet, consectetur adipisicing
-    <b class="target">elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua.</b>
-    Ut enim ad minim veniam.
-</p>
-
- -

上面的示例将渲染出一个有遮罩的例子

- -

{{EmbedLiveSample('Example_Masking', 650, 200)}}

- -

例子: Clipping

- -

此示例演示如何使用 SVG 剪辑 HTML 内容。请注意,即使链接的可点击区域也被剪切。

- -
<p class="target" style="background:lime;">
-    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua. Ut enim ad minim veniam.
-</p>
-<p>
-    Lorem ipsum dolor sit amet, consectetur adipisicing
-    <b class="target">elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua.</b>
-    Ut enim ad minim veniam.
-</p>
-
-<button onclick="toggleRadius()">Toggle radius</button>
-
-<svg height="0">
-  <clipPath id="clipping-path-1" clipPathUnits="objectBoundingBox">
-    <circle cx="0.25" cy="0.25" r="0.25" id="circle"/>
-    <rect x="0.5" y="0.2" width="0.5" height="0.8"/>
-  </clipPath>
-</svg>
-
- -
.target {
-  clip-path: url(#clipping-path-1);
-}
-p {
-  width: 300px;
-  border: 1px solid #000;
-  display: inline-block;
-}
- -

这个例子将建立一个由圆形和矩形组成的剪切区域,为其指定 ID #clipping-path-1,然后在 CSS 中引用它。剪切路径可以分配给具有 target class 的任何元素。

- -

你可以实时地对 SVG 进行更改,并看到它们立即影响 HTML 的渲染。例如,可以在上面建立的剪切路径中调整圆形的大小:

- -
function toggleRadius() {
-  var circle = document.getElementById("circle");
-  circle.r.baseVal.value = 0.40 - circle.r.baseVal.value;
-}
-
- -

{{EmbedLiveSample('Example_Clipping', 650, 200)}}

- -

例子: Filtering

- -

这个例子演示了如何使用 SVG 对 HTML 内容进行过滤。它建立了几个过滤器,这些过滤器与 CSS 一起作用于正常和鼠标悬停状态 hover 下的三个元素。

- -
<p class="target" style="background: lime;">
-    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua. Ut enim ad minim veniam.
-</p>
-<pre class="target">lorem</pre>
-<p>
-    Lorem ipsum dolor sit amet, consectetur adipisicing
-    <b class="target">elit, sed do eiusmod tempor incididunt
-    ut labore et dolore magna aliqua.</b>
-    Ut enim ad minim veniam.
-</p>
-
- -

任何 SVG 过滤器都可以这样使用。例如,要应用模糊效果,你可以这样使用:

- -
<svg height="0">
-  <filter id="f1">
-    <feGaussianBlur stdDeviation="3"/>
-  </filter>
-</svg>
- -

也可以应用于颜色矩阵:

- -
<svg height="0">
-  <filter id="f2">
-    <feColorMatrix values="0.3333 0.3333 0.3333 0 0
-                           0.3333 0.3333 0.3333 0 0
-                           0.3333 0.3333 0.3333 0 0
-                           0      0      0      1 0"/>
-  </filter>
-</svg>
-
- -

或更多的过滤器:

- -
<svg height="0">
-  <filter id="f3">
-    <feConvolveMatrix filterRes="100 100" style="color-interpolation-filters:sRGB"
-      order="3" kernelMatrix="0 -1 0   -1 4 -1   0 -1 0" preserveAlpha="true"/>
-  </filter>
-  <filter id="f4">
-    <feSpecularLighting surfaceScale="5" specularConstant="1"
-                        specularExponent="10" lighting-color="white">
-      <fePointLight x="-5000" y="-10000" z="20000"/>
-    </feSpecularLighting>
-  </filter>
-  <filter id="f5">
-    <feColorMatrix values="1 0 0 0 0
-                           0 1 0 0 0
-                           0 0 1 0 0
-                           0 1 0 0 0" style="color-interpolation-filters:sRGB"/>
-  </filter>
-</svg>
- -

使用以下 CSS 应用五个过滤器:

- -
p.target { filter:url(#f3); }
-p.target:hover { filter:url(#f5); }
-b.target { filter:url(#f1); }
-b.target:hover { filter:url(#f4); }
-pre.target { filter:url(#f2); }
-pre.target:hover { filter:url(#f3); }
-
- -

{{EmbedLiveSample('Example_Filtering', 650, 200)}}

- -

View this example live

- -

例子: Blurred Text

- -

为了模糊文本,基于 Webkit 的浏览器有一个名为 blur 的(前缀)CSS 过滤器,(另见 CSS filter)。你可以使用 SVG 过滤器获得相同的效果。

- -
<p class="blur">Time to clean my glasses</p>
-<svg height="0">
-  <defs>
-    <filter id="wherearemyglasses" x="0" y="0">
-    <feGaussianBlur in="SourceGraphic" stdDeviation="1"/>
-    </filter>
-  </defs>
-</svg>
-
- -

你可以在同一个 class 中使用 SVG 和 CSS 过滤器:

- -
.blur { filter: url(#wherearemyglasses); }
- -

{{ EmbedLiveSample('Example_Blurred_Text', 300, 100) }}

- -

模糊的计算量很大,所以请谨慎使用它,尤其是在包含滚动或动画的元素中。

- - - -

例子: Text Effects

- -

SVG 还可以用于添加比纯 HTML 文本更动态、更灵活的文本添加方法。

- -

通过使用 SVG 元素与 HTML 结合创建文本,你可以产生不同的文本的效果。如旋转文本:

- -
<svg height="60" width="200">
-  <text x="0" y="15" fill="blue" transform="rotate(30 20,50)">Example text</text>
-</svg>
- -

使用外部引用

- -

用来 clipping,masking,filtering 的 SVG 可以从其他外部源载入,只要外部源是与要使用 SVG 的该 HTML 文档同源的。

- -

例如,CSS 规则在一个名为 default.css 的文件中,如下这样:

- -
.target { clip-path: url(resources.svg#c1); }
- -

这个 SVG 就可以从一个名为 resources.svg 的文件中导入,clip 路径为 ID c1。

- -

参见

- - diff --git a/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.md b/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.md new file mode 100644 index 00000000000000..181766c28f9669 --- /dev/null +++ b/files/zh-cn/web/svg/applying_svg_effects_to_html_content/index.md @@ -0,0 +1,260 @@ +--- +title: 在 HTML 内容中应用 SVG 效果 +slug: Web/SVG/Applying_SVG_effects_to_HTML_content +tags: + - CSS + - HTML + - SVG + - XHTML + - 指南 + - 需要示例 +translation_of: Web/SVG/Applying_SVG_effects_to_HTML_content +--- +现代浏览器支持在 [CSS](/zh-CN/docs/Web/CSS) 样式中使用 [SVG](/zh-CN/docs/SVG) 来对 HTML 内容应用图像效果。 + +你可以在同一文件中使用 SVG 样式,也可以通过外部样式表引入。有三个属性可以使用: [`mask`](/zh-CN/docs/Web/CSS/mask), [`clip-path`](/zh-CN/docs/Web/CSS/clip-path), 和 `filter。` + +> **备注:** 在外部文件引入的 SVG 必须与原始文件 [同源](/zh-CN/docs/Web/Security/Same-origin_policy) 。 + +## 使用内嵌 SVG + +要想在 CSS 样式中应用 SVG 效果,首先需要创建一个引用 SVG 的 CSS 样式。 + +```html + +``` + +在上面的例子中,所有段落会被[ID](/zh-CN/docs/Web/HTML/Global_attributes/id) 为`my-mask 的`[SVG ``](/zh-CN/docs/Web/SVG/Element/mask)遮罩。 + +### 示例:Masking + +例如,你可以在你的 HTML 文档中用 SVG 和 CSS 代码对 HTML 内容作渐变 mask 效果。 + +```html + + + + + + + + + + +``` + +```css +.target { + mask: url(#mask-1); +} +p { + width: 300px; + border: 1px solid #000; + display: inline-block; +} +``` + +注意,在 CSS 中 遮罩(mask)使用一个指向 ID 为 `#mask-1`的 URL,这个 ID 是在上面的 SVG 中指定的。 SVG 中其他的内容指定了渐变遮罩的细节。 + +将 SVG 效果应用于 (X)HTML 是通过将 `target` 这个 class 应用于其他元素来实现的,如下所示: + +```html +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. Ut enim ad minim veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing + elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. + Ut enim ad minim veniam. +

+``` + +上面的示例将渲染出一个有遮罩的例子 + +{{EmbedLiveSample('示例:Masking', 650, 200)}} + +### 示例:Clipping + +此示例演示如何使用 SVG 剪辑 HTML 内容。请注意,即使链接的可点击区域也被剪切。 + +```html +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. Ut enim ad minim veniam. +

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing + elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. + Ut enim ad minim veniam. +

+ + + + + + + + + +``` + +```css +.target { + clip-path: url(#clipping-path-1); +} +p { + width: 300px; + border: 1px solid #000; + display: inline-block; +} +``` + +这个例子将建立一个由圆形和矩形组成的剪切区域,为其指定 ID `#clipping-path-1`,然后在 CSS 中引用它。剪切路径可以分配给具有 `target` class 的任何元素。 + +你可以实时地对 SVG 进行更改,并看到它们立即影响 HTML 的渲染。例如,可以在上面建立的剪切路径中调整圆形的大小: + +```js +function toggleRadius() { + var circle = document.getElementById("circle"); + circle.r.baseVal.value = 0.40 - circle.r.baseVal.value; +} +``` + +{{EmbedLiveSample('示例:Clipping', 650, 200)}} + +### 示例:Filtering + +这个例子演示了如何使用 SVG 对 HTML 内容进行过滤。它建立了几个过滤器,这些过滤器与 CSS 一起作用于正常和鼠标悬停状态 [hover](/zh-CN/docs/Web/CSS/:hover) 下的三个元素。 + +```html +

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. Ut enim ad minim veniam. +

+
lorem
+

+ Lorem ipsum dolor sit amet, consectetur adipisicing + elit, sed do eiusmod tempor incididunt + ut labore et dolore magna aliqua. + Ut enim ad minim veniam. +

+``` + +任何 SVG 过滤器都可以这样使用。例如,要应用模糊效果,你可以这样使用: + +```html + + + + + +``` + +也可以应用于颜色矩阵: + +```html + + + + + +``` + +或更多的过滤器: + +```html + + + + + + + + + + + + + +``` + +使用以下 CSS 应用五个过滤器: + +```css +p.target { filter:url(#f3); } +p.target:hover { filter:url(#f5); } +b.target { filter:url(#f1); } +b.target:hover { filter:url(#f4); } +pre.target { filter:url(#f2); } +pre.target:hover { filter:url(#f3); } +``` + +{{EmbedLiveSample('示例:Filtering', 650, 200)}} + +[View this example live](/files/3329/filterdemo.xhtml) + +### 示例:Blurred Text + +为了模糊文本,基于 Webkit 的浏览器有一个名为 blur 的(前缀)CSS 过滤器,(另见 [CSS filter](/zh-CN/docs/Web/CSS/filter#blur%28%29_2))。你可以使用 SVG 过滤器获得相同的效果。 + +```html +

Time to clean my glasses

+ + + + + + + +``` + +你可以在同一个 class 中使用 SVG 和 CSS 过滤器: + +```css +.blur { filter: url(#wherearemyglasses); } +``` + +{{ EmbedLiveSample('示例:Blurred Text', 300, 100) }} + +模糊的计算量很大,所以请谨慎使用它,尤其是在包含滚动或动画的元素中。 + +### 示例:Text Effects + +SVG 还可以用于添加比纯 HTML 文本更动态、更灵活的文本添加方法。 + +通过使用 SVG 元素与 HTML 结合创建文本,你可以产生不同的文本的效果。如旋转文本: + +```svg + + Example text + +``` + +## 使用外部引用 + +用来 clipping,masking,filtering 的 SVG 可以从其他外部源载入,只要外部源是与要使用 SVG 的该 HTML 文档同源的。 + +例如,CSS 规则在一个名为 default.css 的文件中,如下这样: + +```css +.target { clip-path: url(resources.svg#c1); } +``` + +这个 SVG 就可以从一个名为 resources.svg 的文件中导入,clip 路径为 ID c1。 + +## 参见 + +- [SVG](/zh-CN/docs/SVG) +- [SVG Effects for HTML Content](http://robert.ocallahan.org/2008/06/applying-svg-effects-to-html-content_04.html) (blog post) +- ~~[SVG External Document References](/web-tech/2008/10/10/svg-external-document-references)~~ (blog post) ([\[archive.org\] Web Tech Blog » Blog Archive » SVG External Document References](http://web.archive.org/web/20120512132948/https://developer.mozilla.org/web-tech/2008/10/10/svg-external-document-references/)) diff --git a/files/zh-cn/web/svg/attribute/accent-height/index.html b/files/zh-cn/web/svg/attribute/accent-height/index.html deleted file mode 100644 index 520e89981dd1ae..00000000000000 --- a/files/zh-cn/web/svg/attribute/accent-height/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: accent-height -slug: Web/SVG/Attribute/accent-height -translation_of: Web/SVG/Attribute/accent-height ---- -

« 回到 SVG 属性指南首页

- -

此属性定义从原点到重点字符顶部的距离,通过字体坐标系内的距离测量。

- -

若未定义该属性,那么该属性就会被设置为{{ SVGAttr("ascent") }}。

- -

Usage context

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
Value<number>
AnimatableNo
Normative documentSVG 1.1 (2nd Edition)
- -

{{ page("/en-US/docs/SVG/Content_type","Number") }}

- -

Elements

- -

The following elements can use the accent-height attribute

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/accent-height/index.md b/files/zh-cn/web/svg/attribute/accent-height/index.md new file mode 100644 index 00000000000000..343b5e9735efc2 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/accent-height/index.md @@ -0,0 +1,30 @@ +--- +title: accent-height +slug: Web/SVG/Attribute/accent-height +translation_of: Web/SVG/Attribute/accent-height +--- +« 回到 SVG 属性指南首页 + +此属性定义从原点到重点字符顶部的距离,通过字体坐标系内的距离测量。 + +若未定义该属性,那么该属性就会被设置为{{ SVGAttr("ascent") }}。 + +## Usage context + +| Categories | None | +| ------------------ | ------------------------------------------------------------------------------------------------- | +| Value | [](/en/SVG/Content_type#Length) | +| Animatable | No | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/fonts.html#FontFaceElementAccentHeightAttribute) | + +{{ page("/en-US/docs/SVG/Content_type","Number") }} + +## Elements + +The following elements can use the `accent-height` attribute + +- {{ SVGElement("font-face") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/accumulate/index.html b/files/zh-cn/web/svg/attribute/accumulate/index.html deleted file mode 100644 index 3e4da830a836c2..00000000000000 --- a/files/zh-cn/web/svg/attribute/accumulate/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: accumulate -slug: Web/SVG/Attribute/accumulate -tags: - - SVG - - SVG 属性 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/accumulate ---- -

« SVG 属性参考主页

- -

该属性控制了动画是否是累加的。

- -

在原来的结果的基础上重复动画的时候,它通常很有用,每一次循环都累加。这个属性告诉动画是否是每次循环,前一个动画属性值要加上去。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画累加属性
none | sum
可变性No
规范文档SVG 1.1 (2nd Edition)
- -
-
sum
-
指定第一次循环后的每次循环建立在上次循环的终值上。
-
none
-
指定重复循环是不累加的。这是默认值。
-
- -

示例

- -

元素

- -

以下元素可以使用additive属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/accumulate/index.md b/files/zh-cn/web/svg/attribute/accumulate/index.md new file mode 100644 index 00000000000000..8d6c16000e174a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/accumulate/index.md @@ -0,0 +1,43 @@ +--- +title: accumulate +slug: Web/SVG/Attribute/accumulate +tags: + - SVG + - SVG 属性 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/accumulate +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性控制了动画是否是累加的。 + +在原来的结果的基础上重复动画的时候,它通常很有用,每一次循环都累加。这个属性告诉动画是否是每次循环,前一个动画属性值要加上去。 + +## 用法 + +| 类别 | 动画累加属性 | +| -------- | --------------------------------------------------------------------------------- | +| 值 | **none** \| sum | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#AdditionAttributes) | + +- sum + - : 指定第一次循环后的每次循环建立在上次循环的终值上。 +- none + - : 指定重复循环是不累加的。这是默认值。 + +## 示例 + +## 元素 + +以下元素可以使用`additive`属性: + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateMotion") }} +- {{ SVGElement("animateTransform") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/alignment-baseline/index.html b/files/zh-cn/web/svg/attribute/alignment-baseline/index.html deleted file mode 100644 index dfdee45fd52c50..00000000000000 --- a/files/zh-cn/web/svg/attribute/alignment-baseline/index.html +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: alignment-baseline -slug: Web/SVG/Attribute/alignment-baseline -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/alignment-baseline ---- -

« SVG 属性参考主页

- -

alignment-baseline属性指定了一个对象如何相对于它的父元素对齐。这个属性指定了该元素的基线对齐到相应的父元素的基线。举个例子,允许罗马文字中的字母表基线在字体大小发生变化时保持一致。它的默认值是 baseline,与该alignment-baseline属性的计算值同名。

- -

作为一个外观属性,它还可以直接作为 CSS 样式表内部的属性使用。请阅读{{ cssxref("alignment-baseline","CSS alignment-baseline") }}以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别外观属性
auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | inherit
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -

示例

- -
<?xml version="1.0"?>
-<svg width="300" height="120" viewBox="0 0 300 120"
-     xmlns="http://www.w3.org/2000/svg" version="1.1">
-
-    <!-- Materialisation of anchors -->
-    <path d="M60,10 L60,110
-             M30,10 L300,10
-             M30,65 L300,65
-             M30,110 L300,110
-             " stroke="grey" />
-
-    <!-- Anchors in action -->
-    <text alignment-baseline="hanging"
-          x="60" y="10">A hanging</text>
-
-    <text alignment-baseline="middle"
-          x="60" y="65">A middle</text>
-
-    <text alignment-baseline="baseline"
-          x="60" y="110">A baseline</text>
-
-    <!-- Materialisation of anchors -->
-    <circle cx="60" cy="10" r="3" fill="red" />
-    <circle cx="60" cy="65" r="3" fill="red" />
-    <circle cx="60" cy="110" r="3" fill="red" />
-
-<style><![CDATA[
-text{
-    font: bold 36px Verdana, Helvetica, Arial, sans-serif;
-}
-]]></style>
-</svg>
-
- -

元素

- -

下列元素使用alignment-baseline 属性:

- - - -

如果对象要在别的元素中对齐(比如在{{ SVGElement("text") }}元素中),请阅读{{ SVGAttr("dominant-baseline") }}。

- -

规范

- -{{Specifications}} - -

参见

- - diff --git a/files/zh-cn/web/svg/attribute/alignment-baseline/index.md b/files/zh-cn/web/svg/attribute/alignment-baseline/index.md new file mode 100644 index 00000000000000..e09891fbf00dca --- /dev/null +++ b/files/zh-cn/web/svg/attribute/alignment-baseline/index.md @@ -0,0 +1,78 @@ +--- +title: alignment-baseline +slug: Web/SVG/Attribute/alignment-baseline +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/alignment-baseline +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`alignment-baseline`属性指定了一个对象如何相对于它的父元素对齐。这个属性指定了该元素的基线对齐到相应的父元素的基线。举个例子,允许罗马文字中的字母表基线在字体大小发生变化时保持一致。它的默认值是 baseline,与该`alignment-baseline`属性的计算值同名。 + +作为一个外观属性,它还可以直接作为 CSS 样式表内部的属性使用。请阅读{{ cssxref("alignment-baseline","CSS alignment-baseline") }}以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 值 | **auto** \| baseline \| before-edge \| text-before-edge \| middle \| central \| after-edge \| text-after-edge \| ideographic \| alphabetic \| hanging \| mathematical \| inherit | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/text.html#AlignmentBaselineProperty) | + +## 示例 + +```plain + + + + + + + + A hanging + + A middle + + A baseline + + + + + + + + +``` + +## 元素 + +下列元素使用`alignment-baseline 属性:` + +- {{ SVGElement("tspan") }} +- {{ SVGElement("tref") }} +- {{ SVGElement("altGlyph") }} +- {{ SVGElement("textPath") }} + +如果对象要在别的元素中对齐(比如在{{ SVGElement("text") }}元素中),请阅读{{ SVGAttr("dominant-baseline") }}。 + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ cssxref("alignment-baseline","CSS alignment-baseline") }} diff --git a/files/zh-cn/web/svg/attribute/attributename/index.html b/files/zh-cn/web/svg/attribute/attributename/index.html deleted file mode 100644 index 6d4e9e4158f97e..00000000000000 --- a/files/zh-cn/web/svg/attribute/attributename/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: attributeName -slug: Web/SVG/Attribute/attributeName -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/attributeName ---- -

« SVG 属性参考主页

- -

该属性标识了在一个动画动作环节中,父元素的需要被改变的属性名。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画属性目标属性
<attributeName>
可变性No
规范文档SVG 1.1 (2nd Edition)
- -

示例

- -

下面的示例使用了 y 作为attributeName,通过改变一个矩形在 Y 轴上的位置来变动这个矩形。

- -
<?xml version="1.0"?>
-<svg width="250" height="250"
-  viewPort="0 0 250 250" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <rect x="50" y="50" width="100" height="100">
-    <animate attributeType="XML"
-      attributeName="y"
-      from="0" to="50"
-      dur="5s"/>
-  </rect>
-</svg>
- -

元素

- -

下列元素可以使用attributeName属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/attributename/index.md b/files/zh-cn/web/svg/attribute/attributename/index.md new file mode 100644 index 00000000000000..df8273dca3be71 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/attributename/index.md @@ -0,0 +1,51 @@ +--- +title: attributeName +slug: Web/SVG/Attribute/attributeName +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/attributeName +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性标识了在一个动画动作环节中,父元素的需要被改变的属性名。 + +## 用法 + +| 类别 | 动画属性目标属性 | +| -------- | ------------------------------------------------------------------------------------- | +| 值 | | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#AttributeNameAttribute) | + +## 示例 + +下面的示例使用了 y 作为`attributeName`,通过改变一个矩形在 Y 轴上的位置来变动这个矩形。 + +```xml + + + + + + +``` + +## 元素 + +下列元素可以使用`attributeName`属性: + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateTransform") }} +- {{ SVGElement("set") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/attributetype/index.html b/files/zh-cn/web/svg/attribute/attributetype/index.html deleted file mode 100644 index c1b5ed6a098701..00000000000000 --- a/files/zh-cn/web/svg/attribute/attributetype/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: attributeType -slug: Web/SVG/Attribute/attributeType -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/attributeType ---- -

« SVG 属性参考主页

- -

该属性指定目标属性和它相对应的值处于哪个命名空间里。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画属性目标属性
CSS | XML | auto
可变性No
规范文档SVG 1.1 (2nd Edition)
- -

这个属性可取下列值之一:

- -
-
CSS
-
指定{{ SVGAttr("attributeName") }}的值是一个 CSS 属性名。
-
-
XML
-
指定{{ SVGAttr("attributeName") }}的值是一个 XML 属性名,在目标元素的默认 XML 命名空间里。
-
auto
-
编译器将把{{ SVGAttr("attributeName") }}匹配到目标元素的一个属性。用户代理先搜索 CSS 属性列表以找出一个匹配的属性名,如果找不到,再为这个元素搜索默认 XML 命名空间。
-
- -

示例

- -

元素

- -

下列元素可以使用attributeType属性:

- -
    -
  • {{ SVGElement("animate") }}
  • -
  • {{ SVGElement("animateColor") }}
  • -
  • {{ SVGElement("animateTransform") }}
  • -
  • {{ SVGElement("set") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/attributetype/index.md b/files/zh-cn/web/svg/attribute/attributetype/index.md new file mode 100644 index 00000000000000..ae9d664e182ef3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/attributetype/index.md @@ -0,0 +1,46 @@ +--- +title: attributeType +slug: Web/SVG/Attribute/attributeType +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/attributeType +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性指定目标属性和它相对应的值处于哪个命名空间里。 + +## 用法 + +| 类别 | 动画属性目标属性 | +| -------- | ------------------------------------------------------------------------------------- | +| 值 | CSS \| XML \| **auto** | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#AttributeTypeAttribute) | + +这个属性可取下列值之一: + +- CSS + - : 指定{{ SVGAttr("attributeName") }}的值是一个 CSS 属性名。 +- XML + + - : 指定{{ SVGAttr("attributeName") }}的值是一个 XML 属性名,在目标元素的默认 XML 命名空间里。 + +- auto + - : 编译器将把{{ SVGAttr("attributeName") }}匹配到目标元素的一个属性。用户代理先搜索 CSS 属性列表以找出一个匹配的属性名,如果找不到,再为这个元素搜索默认 XML 命名空间。 + +## 示例 + +## 元素 + +下列元素可以使用`attributeType`属性: + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateTransform") }} +- {{ SVGElement("set") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/baseline-shift/index.html b/files/zh-cn/web/svg/attribute/baseline-shift/index.html deleted file mode 100644 index 53bc8f8326324a..00000000000000 --- a/files/zh-cn/web/svg/attribute/baseline-shift/index.html +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: baseline-shift -slug: Web/SVG/Attribute/baseline-shift -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/baseline-shift ---- -

« SVG 属性参考主页

- -

属性baseline-shift允许相对于父文本内容元素的dominant-baseline重定位dominant-baseline。该切换对象必须是一个下标或上标。

- -

作为一个外观属性,它还可以直接作为 CSS 样式表内部的属性使用。请看{{ cssxref("baseline-shift","CSS baseline-shift") }}以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别外观属性
auto | baseline | super | sub | <percentage> | <length> | inherit
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -
-
baseline
-
没有基线切换,dominant-baseline依然在原来的位置。
-
sub
-
dominant-baseline切换到下标的默认位置。
-
super
-
dominant-baseline切换到上标的默认位置
-
<percentage>
-
该属性的结果值是这个百分数乘以 {{ SVGElement("text") }}元素的{{ SVGAttr("line-height") }}。如果是正值,dominant-baseline 向 shift 同方向移动结果值;如果是负值,dominant-baseline 向 shift 反方向移动结果值,相对于父文本内容元素。值“0%”等于”baseline“。
-
<length>
-
如果是正值,dominant-baseline 向 shift 同方向移动<length>距离;如果是负值,dominant-baseline 向 shift 反方向移动<length>距离。值”0cm“等于”baseline“。
-
- -

示例

- -

元素

- -

下列这些元素可以使用 baseline-shift属性。

- -
    -
  • {{ SVGElement("tspan") }}
  • -
  • {{ SVGElement("tref") }}
  • -
  • {{ SVGElement("altGlyph") }}
  • -
  • {{ SVGElement("textPath") }}
  • -
- -

规范

- -{{Specifications}} - -

参见

- -
    -
  • {{ cssxref("baseline-shift","CSS baseline-shift") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/baseline-shift/index.md b/files/zh-cn/web/svg/attribute/baseline-shift/index.md new file mode 100644 index 00000000000000..17c7ebefe8ad6a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/baseline-shift/index.md @@ -0,0 +1,52 @@ +--- +title: baseline-shift +slug: Web/SVG/Attribute/baseline-shift +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/baseline-shift +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +属性`baseline-shift`允许相对于父文本内容元素的`dominant-baseline`重定位`dominant-baseline`。该切换对象必须是一个下标或上标。 + +作为一个外观属性,它还可以直接作为 CSS 样式表内部的属性使用。请看{{ cssxref("baseline-shift","CSS baseline-shift") }}以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| -------- | ---------------------------------------------------------------------------------------------------------- | +| 值 | **auto** \| baseline \| super \| sub \| \| [](/en/SVG/Content_type#Length) \| inherit | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty) | + +- baseline + - : 没有基线切换,`dominant-baseline`依然在原来的位置。 +- sub + - : `dominant-baseline`切换到下标的默认位置。 +- super + - : `dominant-baseline`切换到上标的默认位置 +- \ + - : 该属性的结果值是这个百分数乘以 {{ SVGElement("text") }}元素的{{ SVGAttr("line-height") }}。如果是正值,dominant-baseline 向 shift 同方向移动结果值;如果是负值,dominant-baseline 向 shift 反方向移动结果值,相对于父文本内容元素。值“0%”等于”baseline“。 +- [\](/en/SVG/Content_type#Length) + - : 如果是正值,dominant-baseline 向 shift 同方向移动[\](/en/SVG/Content_type#Length)距离;如果是负值,dominant-baseline 向 shift 反方向移动[\](/en/SVG/Content_type#Length)距离。值”0cm“等于”baseline“。 + +## 示例 + +## 元素 + +`下列这些元素可以使用 baseline-shift`属性。 + +- {{ SVGElement("tspan") }} +- {{ SVGElement("tref") }} +- {{ SVGElement("altGlyph") }} +- {{ SVGElement("textPath") }} + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ cssxref("baseline-shift","CSS baseline-shift") }} diff --git a/files/zh-cn/web/svg/attribute/baseprofile/index.html b/files/zh-cn/web/svg/attribute/baseprofile/index.html deleted file mode 100644 index 355532d6c1c639..00000000000000 --- a/files/zh-cn/web/svg/attribute/baseprofile/index.html +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: baseProfile -slug: Web/SVG/Attribute/baseProfile -translation_of: Web/SVG/Attribute/baseProfile ---- -

« 返回 SVG 特性参考

- -

baseProfile 特性描述了作者认为正确渲染内容所需要的最小的 SVG 语言概述。这个特性不会说明任何处理限制,可以把它看作是元数据。 比如,这个特性的值可以被编辑工具用来在用户的修改超出所指定的基准概述范围时发出警告。

- -

每个 SVG 概述应该为这个特性定义一个适合的文本。如果没有指定这个特性,效果就跟指定 none 一样。

- -

使用背景

- - - - - - - - - - - - - - - - - - - - -
目录
none | full| basic| tiny
动画特性
规范文档SVG 1.1 (第二版)
- -
-
none
-
代表了最小的 SVG 语言配置,没有描述作者关于正确渲染内容的观点。
-
full
-
代表一个正常的概述,适用于 PC。
-
basic
-
代表一个轻量级的概述,适用于 PDA。
-
tiny
-
代表更轻量的概述,适用于手机。
-
- -

例子

- -
<svg width="120" height="120" version="1.1"
- xmlns="http://www.w3.org/2000/svg" baseProfile="full">
-
-  ...
-
-</svg>
- -

元素

- -

以下元素会用到 baseProfile 特性

- -
    -
  • {{ SVGElement("svg") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/baseprofile/index.md b/files/zh-cn/web/svg/attribute/baseprofile/index.md new file mode 100644 index 00000000000000..72a8f981a99b9f --- /dev/null +++ b/files/zh-cn/web/svg/attribute/baseprofile/index.md @@ -0,0 +1,44 @@ +--- +title: baseProfile +slug: Web/SVG/Attribute/baseProfile +translation_of: Web/SVG/Attribute/baseProfile +--- +« 返回 SVG 特性参考 + +`baseProfile` 特性描述了作者认为正确渲染内容所需要的最小的 SVG 语言概述。这个特性不会说明任何处理限制,可以把它看作是元数据。 比如,这个特性的值可以被编辑工具用来在用户的修改超出所指定的基准概述范围时发出警告。 + +每个 SVG 概述应该为这个特性定义一个适合的文本。如果没有指定这个特性,效果就跟指定 `none` 一样。 + +## 使用背景 + +| 目录 | 无 | +| -------- | ------------------------------------------------------------------------------ | +| 值 | **none** \| full\| basic\| tiny | +| 动画特性 | 无 | +| 规范文档 | [SVG 1.1 (第二版)](http://www.w3.org/TR/SVG11/text.html#BaselineShiftProperty) | + +- none + - : 代表了最小的 SVG 语言配置,没有描述作者关于正确渲染内容的观点。 +- full + - : 代表一个正常的概述,适用于 PC。 +- basic + - : 代表一个轻量级的概述,适用于 PDA。 +- tiny + - : 代表更轻量的概述,适用于手机。 + +## 例子 + +```html + + + ... + + +``` + +## 元素 + +以下元素会用到 `baseProfile` 特性 + +- {{ SVGElement("svg") }} diff --git a/files/zh-cn/web/svg/attribute/begin/index.html b/files/zh-cn/web/svg/attribute/begin/index.html deleted file mode 100644 index dea534ccbabcf6..00000000000000 --- a/files/zh-cn/web/svg/attribute/begin/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: begin -slug: Web/SVG/Attribute/begin -tags: - - SVG - - SVG 属性 - - 参考 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/begin ---- -

« SVG 属性参考主页

- -

这个属性定义了动画何时开始。

- -

这个属性值是一个分号分隔的数列值。SMIL 规范的"Evaluation of begin and end time lists"章节详细解释了开始时间数列。每个单独的值可以是下述之一:<offset-value><syncbase-value><event-value><repeat-value><accessKey-value><wallclock-sync-value>或者关键词indefinite

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画定时属性
<begin-value-list>
可变性No
规范文档SVG 1.1 (2nd Edition)
- -

<begin-value-list>中的每一个值可以是下述之一:

- -
-
<offset-value>
-
一个时钟值代表了一个相对于 SVG 文档开头的时间点,SVG 文档开头通常是指 load 事件或者 DOMReady 事件触发的时间点。负值是合法的。
-
<syncbase-value>
-
描述一个syncbase以及一个可选的来自于syncbase的时偏移。元素的动画开始时间被定义为相对于另一个动画的开头或者激活结束。一个 ID 及其后面跟着的 .begin 或 .end 构成了一个 syncbase,ID 引用到另一个动画元素,.begin 或 .end 用来确定到底是与引用的动画元素的动画开头同步、还是与引用的动画元素的动画激活结束同步。
-
<event-value>
-
描述了一个事件以及一个可选的时偏移,用来确定动画开始的时点。触发指定事件的时点,被定义为动画开始的时点。一个元素 ID 及其后面跟着的一个点及其后面跟着事件名构成了一个合法的 event-value 值。事件名必须是元素支持的事件名。全部合法的事件(不一定是所有元素都支持的事件)包括这些:focusin、focusout、activateclickmousedownmouseupmouseovermousemovemouseoutDOMSubtreeModifiedDOMNodeInsertedDOMNodeRemovedDOMNodeRemovedFromDocumentDOMNodeInsertedIntoDocumentDOMAttrModifiedDOMCharacterDataModifiedSVGLoadSVGUnloadSVGAbortSVGErrorSVGResizeSVGScrollSVGZoombeginEventendEventrepeatEvent。
-
<repeat-value>
-
描述了一个符合条件重复事件。repeat 事件发生了指定次数的时间点,被定义为元素动画的开始时间点。
-
<accessKey-value>
-
描述了一个用来触发动画的访问键。当用户按下指定的键时,元素动画就开始了。
-
<wallclock-sync-value>
-
描述了一个动画开始时间,是真实世界钟的时点。时点的句法遵守 ISO8601 定义的句法。
-
- -

示例

- -

Offset 示例

- -

» begin-1-offset.svg

- -

Syncbase 示例

- -

» begin-2-syncbase.svg

- -

Event 示例

- -

» begin-3-event.svg

- -

Repeat 示例

- -

» begin-4-repeat.svg

- -

Accesskey 示例

- -

» begin-5-accesskey.svg

- -

元素

- -

下列元素可以使用begin属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/begin/index.md b/files/zh-cn/web/svg/attribute/begin/index.md new file mode 100644 index 00000000000000..3670cd8098a4d3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/begin/index.md @@ -0,0 +1,70 @@ +--- +title: begin +slug: Web/SVG/Attribute/begin +tags: + - SVG + - SVG 属性 + - 参考 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/begin +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +这个属性定义了动画何时开始。 + +这个属性值是一个分号分隔的数列值。SMIL 规范的["Evaluation of begin and end time lists"](http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-EvaluationOfBeginEndTimeLists)章节详细解释了开始时间数列。每个单独的值可以是下述之一:``、``、``、``、``、``或者关键词`indefinite`。 + +## 用法 + +| 类别 | 动画定时属性 | +| -------- | ----------------------------------------------------------------------------- | +| 值 | | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#BeginAttribute) | + +``中的每一个值可以是下述之一: + +- \ + - : 一个[时钟值](/en/SVG/Content_type#Clock-value)代表了一个相对于 SVG 文档开头的时间点,SVG 文档开头通常是指 load 事件或者 DOMReady 事件触发的时间点。负值是合法的。 +- \ + - : 描述一个*syncbase*以及一个可选的来自于*syncbase*的时偏移。元素的动画开始时间被定义为相对于另一个动画的开头或者激活结束。一个 ID 及其后面跟着的 .begin 或 .end 构成了一个 syncbase,ID 引用到另一个动画元素,.begin 或 .end 用来确定到底是与引用的动画元素的动画开头同步、还是与引用的动画元素的动画激活结束同步。 +- \ + - : 描述了一个事件以及一个可选的时偏移,用来确定动画开始的时点。触发指定事件的时点,被定义为动画开始的时点。一个元素 ID 及其后面跟着的一个点及其后面跟着事件名构成了一个合法的 event-value 值。事件名必须是元素支持的事件名。全部合法的事件(不一定是所有元素都支持的事件)包括这些:focusin、focusout、`activate`、`click`、`mousedown`、`mouseup`、`mouseover`、`mousemove`、`mouseout`、`DOMSubtreeModified`、`DOMNodeInserted`、`DOMNodeRemoved`、`DOMNodeRemovedFromDocument`、`DOMNodeInsertedIntoDocument`、`DOMAttrModified`、`DOMCharacterDataModified`、`SVGLoad`、`SVGUnload`、`SVGAbort`、`SVGError`、`SVGResize`、`SVGScroll`、`SVGZoom`、`beginEvent`、`endEvent`和`repeatEvent。` +- \ + - : 描述了一个符合条件重复事件。repeat 事件发生了指定次数的时间点,被定义为元素动画的开始时间点。 +- \ + - : 描述了一个用来触发动画的访问键。当用户按下指定的键时,元素动画就开始了。 +- \ + - : 描述了一个动画开始时间,是真实世界钟的时点。时点的句法遵守 ISO8601 定义的句法。 + +## 示例 + +### Offset 示例 + +» [begin-1-offset.svg](https://developer.mozilla.org/files/3290/begin-1-offset.svg) + +### Syncbase 示例 + +» [begin-2-syncbase.svg](https://developer.mozilla.org/files/3291/begin-2-syncbase.svg) + +### Event 示例 + +» [begin-3-event.svg](https://developer.mozilla.org/files/3292/begin-3-event.svg) + +### Repeat 示例 + +» [begin-4-repeat.svg](https://developer.mozilla.org/files/3293/begin-4-repeat.svg) + +### Accesskey 示例 + +» [begin-5-accesskey.svg](https://developer.mozilla.org/files/3294/begin-5-accesskey.svg) + +## 元素 + +下列元素可以使用`begin`属性: + +- [动画元素](/en/SVG/Element#Animation) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/calcmode/index.html b/files/zh-cn/web/svg/attribute/calcmode/index.html deleted file mode 100644 index 10f13a6e194640..00000000000000 --- a/files/zh-cn/web/svg/attribute/calcmode/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: calcMode -slug: Web/SVG/Attribute/calcMode -translation_of: Web/SVG/Attribute/calcMode ---- -

« SVG Attribute reference home

-

This attribute specifies the interpolation mode for the animation. The default mode is linear, however if the attribute does not support linear interpolation (e.g. for strings), the calcMode attribute is ignored and discrete interpolation is used.

-

Usage context

- -
Categories Animation value attribute
Value discrete | linear | paced | spline
Animatable No
Normative document SVG 1.1 (2nd Edition)
-
discrete
This specifies that the animation function will jump from one value to the next without any interpolation.
linear
Simple linear interpolation between values is used to calculate the animation function. Except for {{ SVGElement("animateMotion") }}, this is the default value.
paced
Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any {{ SVGAttr("keyTimes") }} or {{ SVGAttr("keySplines") }} will be ignored. For {{ SVGElement("animateMotion") }}, this is the default value.
spline
Interpolates from one value in the {{ SVGAttr("values") }} list to the next according to a time function defined by a cubic Bézier spline. The points of the spline are defined in the {{ SVGAttr("keyTimes") }} attribute, and the control points for each interval are defined in the {{ SVGAttr("keySplines") }} attribute.
-
-

Example

-

Elements

-

The following elements can use the calcMode attribute

-
  • {{ SVGElement("animate") }}
  • {{ SVGElement("animateColor") }}
  • {{ SVGElement("animateMotion") }}
  • {{ SVGElement("animateTransform") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/calcmode/index.md b/files/zh-cn/web/svg/attribute/calcmode/index.md new file mode 100644 index 00000000000000..f7fa85b6bd0a14 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/calcmode/index.md @@ -0,0 +1,40 @@ +--- +title: calcMode +slug: Web/SVG/Attribute/calcMode +translation_of: Web/SVG/Attribute/calcMode +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +This attribute specifies the interpolation mode for the animation. The default mode is **linear**, however if the attribute does not support linear interpolation (e.g. for strings), the `calcMode` attribute is ignored and discrete interpolation is used. + +## Usage context + +| Categories | Animation value attribute | +| ------------------ | -------------------------------------------------------------------------------- | +| Value | discrete \| linear \| paced \| spline | +| Animatable | No | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#CalcModeAttribute) | + +- discrete + - : This specifies that the animation function will jump from one value to the next without any interpolation. +- linear + - : Simple linear interpolation between values is used to calculate the animation function. Except for {{ SVGElement("animateMotion") }}, this is the default value. +- paced + - : Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any {{ SVGAttr("keyTimes") }} or {{ SVGAttr("keySplines") }} will be ignored. For {{ SVGElement("animateMotion") }}, this is the default value. +- spline + - : Interpolates from one value in the {{ SVGAttr("values") }} list to the next according to a time function defined by a cubic Bézier spline. The points of the spline are defined in the {{ SVGAttr("keyTimes") }} attribute, and the control points for each interval are defined in the {{ SVGAttr("keySplines") }} attribute. + +## Example + +## Elements + +The following elements can use the `calcMode` attribute + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateMotion") }} +- {{ SVGElement("animateTransform") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/clip-path/index.html b/files/zh-cn/web/svg/attribute/clip-path/index.html deleted file mode 100644 index 5f0f935461bf63..00000000000000 --- a/files/zh-cn/web/svg/attribute/clip-path/index.html +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: clip-path -slug: Web/SVG/Attribute/clip-path -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/clip-path ---- -
{{SVGRef}}
- -

元素的表现属性 clip-path 为其定义或关联一条剪切路径。

- -

注意:clip-path 是一个表现属性,可以作为 CSS 属性使用。

- -

作为一种表现属性,clip-path 可以用于任何元素,不过效果最明显的是下列十九种元素:{{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('ellipse')}}, {{SVGElement('g')}}, {{SVGElement('glyph')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}}, {{SVGElement('use')}}

- -
- - -
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
-  <clipPath id="myClip" clipPathUnits="objectBoundingBox">
-    <circle cx=".5" cy=".5" r=".5" />
-  </clipPath>
-
-  <!-- 左上:应用自定义的剪切路径 -->
-  <rect x="1" y="1" width="8" height="8" stroke="green"
-        clip-path="url(#myClip)" />
-
-  <!-- 右上:应用 CSS 基本形状和 fill-box 几何。
-       实质上和自定义剪切路径并把 clipPathUnits
-       设成 objectBoundingBox 一样 -->
-  <rect x="11" y="1" width="8" height="8" stroke="green"
-        clip-path="circle() fill-box" />
-
-  <!-- 左下 -->
-  <rect x="1" y="11" width="8" height="8" stroke="green"
-        clip-path="circle() stroke-box" />
-
-  <!-- 右下:应用 CSS 基本形状和 view-box 几何。
-       实质上和自定义剪切路径并把 clipPathUnits
-       设成 userSpaceOnUse 一样 -->
-  <rect x="11" y="11" width="8" height="8" stroke="green"
-        clip-path="circle() view-box" />
-</svg>
- -

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

-
- -

Usage notes

- - - - - - - - - - - - - - - - -
{{cssxref('url')}} | [ {{cssxref('basic-shape')}} || <geometry-box> ] | none
默认值none
Animatable
- -
-
<geometry-box>
-
geometry-box 是应用 {{cssxref('basic-shape')}} 的额外信息,用于区分 CSS 基本形状如何应用于元素上:fill-box 表示将对象的包围框作为参照框;stroke-box 表示将对象的包围框加上描边的范围作为参照框;view-box 表示使用最近的 SVG 视窗作为参照框。
-
- -

注意:clip-path 语法的更多细节可参考 CSS 属性 {{cssxref('clip-path')}} 的参考页面。

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

- -

See also

- -
    -
  • The CSS {{cssxref("clip-path")}} property
  • -
diff --git a/files/zh-cn/web/svg/attribute/clip-path/index.md b/files/zh-cn/web/svg/attribute/clip-path/index.md new file mode 100644 index 00000000000000..30a63c789cfb59 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/clip-path/index.md @@ -0,0 +1,75 @@ +--- +title: clip-path +slug: Web/SVG/Attribute/clip-path +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/clip-path +--- +{{SVGRef}} + +元素的表现属性 **`clip-path`** 为其定义或关联一条剪切路径。 + +**注意:**`clip-path` 是一个表现属性,可以作为 CSS 属性使用。 + +作为一种表现属性,`clip-path` 可以用于任何元素,不过效果最明显的是下列十九种元素:{{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('ellipse')}}, {{SVGElement('g')}}, {{SVGElement('glyph')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}}, {{SVGElement('use')}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## Usage notes + +| 值 | {{cssxref('url')}} \| [ {{cssxref('basic-shape')}} \|\| `` ] \| `none` | +| ---------- | ---------------------------------------------------------------------------------------------------- | +| 默认值 | `none` | +| Animatable | 是 | + +- \ + - : geometry-box 是应用 {{cssxref('basic-shape')}} 的额外信息,用于区分 CSS 基本形状如何应用于元素上:`fill-box` 表示将对象的包围框作为参照框;`stroke-box` 表示将对象的包围框加上描边的范围作为参照框;`view-box` 表示使用最近的 SVG 视窗作为参照框。 + +**注意:**clip-path 语法的更多细节可参考 CSS 属性 {{cssxref('clip-path')}} 的参考页面。 + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} + +## See also + +- The CSS {{cssxref("clip-path")}} property diff --git a/files/zh-cn/web/svg/attribute/clip/index.html b/files/zh-cn/web/svg/attribute/clip/index.html deleted file mode 100644 index afc39cb2751b5a..00000000000000 --- a/files/zh-cn/web/svg/attribute/clip/index.html +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: clip -slug: Web/SVG/Attribute/clip -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/clip ---- -
{{SVGRef}}{{deprecated_header}}
- -

clip 属性是定义元素可见区域的属性。

- -

clip 属性的参数值与 {{ cssxref("clip","CSS clip property") }} 的参数值定义相同。指示当前用户坐标的无单位的值,可以用在 <shape> 的坐标值上。auto 值定义了一个剪切路径,其边界沿着由给定元素创建的视口的边界。

- -

As a presentation attribute, it can be applied to any element but it has effect only on the following six elements: {{ SVGElement("svg") }}, {{ SVGElement("symbol") }}, {{ SVGElement("image") }}, {{ SVGElement("foreignObject") }}, {{ SVGElement("pattern") }}, {{ SVGElement("marker") }}

- -
- - -
<svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg">
-  <!-- Auto clipping -->
-  <svg x="0" width="10" height="10"
-       clip="auto">
-    <circle cx="5" cy="5" r="4" stroke="green" />
-  </svg>
-
-  <!-- Rect(top, right, bottom, left) clipping -->
-  <svg x="10" width="10" height="10"
-       clip="rect(1, 9, 8, 2)">
-    <circle cx="5" cy="5" r="4" stroke="green" />
-  </svg>
-</svg>
- -

{{EmbedLiveSample('topExample', '100%', 150)}}

-
- -

用法

- -

Warning: This property is deprecated. Use {{cssxref("clip-path")}} instead.

- - - - - - - - - - - - - - - - -
可用值auto | <shape> | inherit
默认值Yes
AnimatableYes
- -

The value auto defines a clipping path along the bounds of the viewport created by the given element.

- -

The value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>). The <top> and <bottom> values specify offsets from the top border edge of the element viewport, while <right> and <left> specify offsets from the left border edge of the element viewport.

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/clip/index.md b/files/zh-cn/web/svg/attribute/clip/index.md new file mode 100644 index 00000000000000..f2ae4433db1d6f --- /dev/null +++ b/files/zh-cn/web/svg/attribute/clip/index.md @@ -0,0 +1,60 @@ +--- +title: clip +slug: Web/SVG/Attribute/clip +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/clip +--- +{{SVGRef}}{{deprecated_header}} + +**`clip`** 属性是定义元素可见区域的属性。 + +`clip` 属性的参数值与 {{ cssxref("clip","CSS clip property") }} 的参数值定义相同。指示当前用户坐标的无单位的值,可以用在 `` 的坐标值上。`auto` 值定义了一个剪切路径,其边界沿着由给定元素创建的视口的边界。 + +As a presentation attribute, it can be applied to any element but it has effect only on the following six elements: {{ SVGElement("svg") }}, {{ SVGElement("symbol") }}, {{ SVGElement("image") }}, {{ SVGElement("foreignObject") }}, {{ SVGElement("pattern") }}, {{ SVGElement("marker") }} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 150)}} + +## 用法 + +**Warning:** This property is deprecated. Use {{cssxref("clip-path")}} instead. + +| 可用值 | **auto** \| \| inherit | +| ---------- | ------------------------------ | +| 默认值 | Yes | +| Animatable | Yes | + +The value `auto` defines a clipping path along the bounds of the viewport created by the given element. + +The value `rect()` defines a clipping rectangle following the following syntax: `rect(, , , )`. The `` and `` values specify offsets from the _top border edge_ of the element viewport, while `` and `` specify offsets from the _left border edge_ of the element viewport. + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/color/index.html b/files/zh-cn/web/svg/attribute/color/index.html deleted file mode 100644 index 5b2000c29cb0f6..00000000000000 --- a/files/zh-cn/web/svg/attribute/color/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: color -slug: Web/SVG/Attribute/color -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/color ---- -

« SVG 属性参考主页

- -

color 属性用来为 {{ SVGAttr("fill") }} 属性、{{ SVGAttr("stroke") }} 属性、{{ SvgAttr("stop-color") }} 属性、{{ SVGAttr("flood-color") }} 属性和 {{ SVGAttr("lighting-color") }} 属性提供一个潜在的间接值(currentColor)。

- -

作为一个外观属性,它还可以直接用作 CSS 样式表的属性。请阅读 {{ cssxref("color","CSS color") }} 以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<color> | inherit
规范文档SVG 1.1 (2nd Edition)
- -

示例

- -
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" version="1.1">
-  <g color="green">
-    <rect width="50" height="50" fill="currentColor" />
-    <circle r="25" cx="70" cy="70" stroke="currentColor" fill="none" stroke-width="5" />
-  </g>
-</svg>
-
- -

{{ EmbedLiveSample('Example', '100%', '110') }}

- -

元素

- -

下列元素可以使用color属性:

- -
    -
  • 文本内容元素 »
  • -
  • 形状元素 »
  • -
  • {{ SVGElement("stop") }}
  • -
  • {{ SVGElement("feFlood") }}
  • -
  • {{ SVGElement("feDiffuseLighting") }}
  • -
  • {{ SVGElement("feSpecularLighting") }}
  • -
- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/color/index.md b/files/zh-cn/web/svg/attribute/color/index.md new file mode 100644 index 00000000000000..c4f8979e32aa17 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/color/index.md @@ -0,0 +1,52 @@ +--- +title: color +slug: Web/SVG/Attribute/color +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/color +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`color` 属性用来为 {{ SVGAttr("fill") }} 属性、{{ SVGAttr("stroke") }} 属性、{{ SvgAttr("stop-color") }} 属性、{{ SVGAttr("flood-color") }} 属性和 {{ SVGAttr("lighting-color") }} 属性提供一个潜在的间接值(`currentColor`)。 + +作为一个外观属性,它还可以直接用作 CSS 样式表的属性。请阅读 {{ cssxref("color","CSS color") }} 以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| -------- | ---------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Color) \| inherit | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/color.html#ColorProperty) | + +## 示例 + +```html + + + + + + +``` + +{{ EmbedLiveSample('Example', '100%', '110') }} + +## 元素 + +下列元素可以使用`color`属性: + +- [文本内容元素](/en/SVG/Element#Text_content_elements) » +- [形状元素](/en/SVG/Element#Shape_elements) » +- {{ SVGElement("stop") }} +- {{ SVGElement("feFlood") }} +- {{ SVGElement("feDiffuseLighting") }} +- {{ SVGElement("feSpecularLighting") }} + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/cx/index.html b/files/zh-cn/web/svg/attribute/cx/index.html deleted file mode 100644 index 2bee4a87dad0d7..00000000000000 --- a/files/zh-cn/web/svg/attribute/cx/index.html +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: cx -slug: Web/SVG/Attribute/cx -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/cx ---- -
{{SVGRef}}
- -

cx 属性定义一个中心点的 x 轴坐标。

- -

有三个元素在使用此属性:{{SVGElement("circle")}}, {{SVGElement("ellipse")}}, 和 {{SVGElement("radialGradient")}}

- -
- - -
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
-  <radialGradient cx="25%" id="myGradient">
-    <stop offset="0"    stop-color="white" />
-    <stop offset="100%" stop-color="black" />
-  </radialGradient>
-
-  <circle cx="50" cy="50" r="45"/>
-  <ellipse cx="150" cy="50" rx="45" ry="25" />
-  <rect x="205" y="5" width="90" height="90" fill="url(#myGradient)" />
-</svg>
- -

{{EmbedLiveSample('topExample', 100, 100)}}

-
- -

- -

对于 {{SVGElement('circle')}},cx 用来定义图形中心的 x 轴坐标。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值0
可变性Yes
- -

注:起始于 SVG2 cx,是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。

- -

椭圆

- -

对于 {{SVGElement('ellipse')}},cx 用来定义图形中心的 x 轴坐标。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值0
可变性Yes
- -

注: 起始于 SVG2 cx,是一个几何属性,意味着该属性也可以用作椭圆的 CSS 属性。

- -

径向渐变

- -

对于 {{SVGElement('radialGradient')}}, cx 用来定义径向渐变终止圆的 x 轴坐标。

- - - - - - - - - - - - - - - - -
<length>
默认值50%
可变性Yes
- -

示例

- - - -
<svg viewBox="0 0 34 10" xmlns="http://www.w3.org/2000/svg">
-  <defs>
-    <radialGradient cx="0" id="myGradient000">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-
-    <radialGradient cx="50%" id="myGradient050">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-
-    <radialGradient cx="100%" id="myGradient100">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-  </defs>
-
-  <rect x="1"  y="1" width="8" height="8" fill="url(#myGradient000)" stroke="black" />
-  <rect x="13" y="1" width="8" height="8" fill="url(#myGradient050)" stroke="black" />
-  <rect x="25" y="1" width="8" height="8" fill="url(#myGradient100)" stroke="black" />
-</svg>
- -

{{EmbedLiveSample('radialGradient', 150, '100%')}}

- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/cx/index.md b/files/zh-cn/web/svg/attribute/cx/index.md new file mode 100644 index 00000000000000..335d85eeefb0ea --- /dev/null +++ b/files/zh-cn/web/svg/attribute/cx/index.md @@ -0,0 +1,105 @@ +--- +title: cx +slug: Web/SVG/Attribute/cx +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/cx +--- +{{SVGRef}} + +**`cx`** 属性定义一个中心点的 x 轴坐标。 + +有三个元素在使用此属性:{{SVGElement("circle")}}, {{SVGElement("ellipse")}}, 和 {{SVGElement("radialGradient")}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', 100, 100)}} + +## 圆 + +对于 {{SVGElement('circle')}},`cx` 用来定义图形中心的 x 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `0` | +| 可变性 | Yes | + +注:起始于 SVG2 `cx`,是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。 + +## 椭圆 + +对于 {{SVGElement('ellipse')}},`cx` 用来定义图形中心的 x 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `0` | +| 可变性 | Yes | + +**注:** 起始于 SVG2 `cx`,是一个几何属性,意味着该属性也可以用作椭圆的 CSS 属性。 + +## 径向渐变 + +对于 {{SVGElement('radialGradient')}}, `cx` 用来定义径向渐变终止圆的 x 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** | +| ------ | ------------------------------------------------- | +| 默认值 | `50%` | +| 可变性 | Yes | + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('径向渐变', 150, '100%')}} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/cy/index.html b/files/zh-cn/web/svg/attribute/cy/index.html deleted file mode 100644 index 0f088efc30ff5f..00000000000000 --- a/files/zh-cn/web/svg/attribute/cy/index.html +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: cy -slug: Web/SVG/Attribute/cy -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/cy ---- -
{{SVGRef}}
- -

cy 属性定义一个中心点的 y 轴坐标。

- -

有三个元素在使用此属性:{{SVGElement("circle")}},{{SVGElement("ellipse")}} 和 {{SVGElement("radialGradient")}}

- -
- - -
<svg viewBox="0 0 100 300" xmlns="http://www.w3.org/2000/svg">
-  <radialGradient cy="25%" id="myGradient">
-    <stop offset="0"    stop-color="white" />
-    <stop offset="100%" stop-color="black" />
-  </radialGradient>
-
-  <circle  cy="50"  cx="50" r="45"/>
-  <ellipse cy="150" cx="50" rx="45" ry="25" />
-  <rect x="5" y="205" width="90" height="90" fill="url(#myGradient)" />
-</svg>
- -

{{EmbedLiveSample('topExample', '100%', 300)}}

-
- -

- -

对于 {{SVGElement('circle')}},cy 用来定义图形中心的 y 轴坐标。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值0
可变性Yes
- -

注:起始于 SVG2,cy 是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。

- -

椭圆

- -

对于 {{SVGElement('ellipse')}},cy 用来定义图形中心的 y 轴坐标。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值0
可变性Yes
- -

注:起始于 SVG2,cy 是一个几何属性,意味着该属性也可以用作椭圆的 CSS 属性。

- -

径向渐变

- -

对于 {{SVGElement('radialGradient')}},cy 用来定义径向渐变终止圆的 y 轴坐标。

- - - - - - - - - - - - - - - - -
<length>
默认值50%
可变性Yes
- -

示例

- - - -
<svg viewBox="0 0 34 10" xmlns="http://www.w3.org/2000/svg">
-  <defs>
-    <radialGradient cy="0" id="myGradient000">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-
-    <radialGradient cy="50%" id="myGradient050">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-
-    <radialGradient cy="100%" id="myGradient100">
-      <stop offset="0%"   stop-color="gold" />
-      <stop offset="50%"  stop-color="green" />
-      <stop offset="100%" stop-color="white" />
-    </radialGradient>
-  </defs>
-
-  <rect x="1"  y="1" width="8" height="8" fill="url(#myGradient000)" stroke="black" />
-  <rect x="13" y="1" width="8" height="8" fill="url(#myGradient050)" stroke="black" />
-  <rect x="25" y="1" width="8" height="8" fill="url(#myGradient100)" stroke="black" />
-</svg>
- -

{{EmbedLiveSample('radialGradient', 150, '100%')}}

- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/cy/index.md b/files/zh-cn/web/svg/attribute/cy/index.md new file mode 100644 index 00000000000000..bf4df2455133df --- /dev/null +++ b/files/zh-cn/web/svg/attribute/cy/index.md @@ -0,0 +1,105 @@ +--- +title: cy +slug: Web/SVG/Attribute/cy +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/cy +--- +{{SVGRef}} + +**`cy`** 属性定义一个中心点的 y 轴坐标。 + +有三个元素在使用此属性:{{SVGElement("circle")}},{{SVGElement("ellipse")}} 和 {{SVGElement("radialGradient")}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 300)}} + +## 圆 + +对于 {{SVGElement('circle')}},`cy` 用来定义图形中心的 y 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `0` | +| 可变性 | Yes | + +**注:**起始于 SVG2,`cy` 是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。 + +## 椭圆 + +对于 {{SVGElement('ellipse')}},`cy` 用来定义图形中心的 y 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `0` | +| 可变性 | Yes | + +**注:**起始于 SVG2,`cy` 是一个几何属性,意味着该属性也可以用作椭圆的 CSS 属性。 + +## 径向渐变 + +对于 {{SVGElement('radialGradient')}},`cy` 用来定义径向渐变终止圆的 y 轴坐标。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** | +| ------ | ------------------------------------------------- | +| 默认值 | `50%` | +| 可变性 | Yes | + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('径向渐变', 150, '100%')}} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/d/index.html b/files/zh-cn/web/svg/attribute/d/index.html deleted file mode 100644 index 90be9ddf36055a..00000000000000 --- a/files/zh-cn/web/svg/attribute/d/index.html +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: d -slug: Web/SVG/Attribute/d -tags: - - SVG - - SVG 元素 - - 参考 -translation_of: Web/SVG/Attribute/d ---- -

« SVG 属性参考主页

- -

该属性定义了一个路径。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别路径定义属性
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -

属性d实际上是一个字符串,包含了一系列路径描述。这些路径由下面这些指令组成:

- -
    -
  • Moveto
  • -
  • Lineto
  • -
  • Curveto
  • -
  • Arcto
  • -
  • ClosePath
  • -
- -

这些组合在一个字符串中。这些不同的命令是大小写敏感的;一个大写的命令指明它的参数是绝对位置,而小写的命令指明相对于当前位置的点。可以指定一个负数值作为命令的参数:负角度将是逆时针的,绝对 x 和 y 位置将视为负坐标。负相对 x 值将会往左移,而负相对 y 值将会向上移。

- -

Moveto

- -

Moveto指令可以被想象成拎起绘图笔,落脚到另一处。在上一个点和这个指定点之间没有线段绘制。用一个 Moveto 命令开始一个路径是好的作法,因为如果没有一个初始化的 Moveto,执行命令时开始点会是上一个操作发生过的地方,这样可能造成不确定的行为。

- -

句法:

- -
    -
  • M x,y 在这里 x 和 y 是绝对坐标,分别代表水平坐标和垂直坐标。
  • -
  • m dx,dy 在这里 dx 和 dy 是相对于当前点的距离,分别是向右和向下的距离。
  • -
- -

示例:

- -
    -
  • 位于绝对位置 x=50, y= 100:<path d="M50,100..." />
  • -
  • 往右移 50,往下移 100:<path d="m50,100..." />
  • -
- -

Lineto

- -

Moveto指令不同,Lineto指令将绘制一条直线段。这个直线段从当前位置移到指定位置。原生的Lineto命令的句法是”L x, y“或者”l dx, dy“,在这里 x 和 y 是绝对坐标,而 dx 和 dy 分别是向右和向下的距离。还有字母 H 和 V,分别指定水平和垂直移动。它们的句法与 L 相同,它的小写版本是相对距离,大写版本是绝对位置。

- -

Curveto

- -

Curvto 命令指定了一个贝塞尔曲线。有两种类型的贝塞尔曲线:立方曲线和二次方曲线。二次方贝塞尔曲线是一种特殊的立方贝塞尔曲线,在这里,控制点的两端是相同的。二次方贝塞尔曲线的句法是”Q cx, cy x, y“或”q dcx, dcy dx, dy“。cx 和 cy 都是控制点的绝对坐标,而 dcx 和 dcy 分别是控制点在 x 和 y 方向上的距离。

- -
-

立方贝赛尔曲线遵守二次方贝赛尔曲线同样的概念,但是它需要考虑两个控制点。立方贝塞尔曲线的句法是:”C c1x,c1y c2x,c2y x,y“或者”c dc1x,dc1y dc2x,dc2y dx,dy“,在这里,c1x、c1y 和 c2x、c2y 是分别是初始点和结束点的控制点的绝对坐标。dc1x、dc1y 和 dc2x、dc2y 都是相对于初始点,而不是相对于结束点的。dx 和 dy 分别是向右和向下的距离。

- -

为了连缀平滑的贝塞尔曲线,还可以使用 T 和 S 命令。它们的语法比别的 Curveto 命令简单,因为它假定第一个控制点是从前一个控制点关于前一个点的反射,或者说如果没有前一个控制点的话它实际上就是前一个点。T 的句法是”T x,y“或者”t dx,dy“,分别对应于绝对坐标和相对距离,用来创建二次方贝塞尔曲线。S 用来创建立方贝塞尔曲线,语法是”S cx,cy x,y“或者”s dcx,dcy dx,dy“,在这里 (d)cx 指定第二个控制点。

- -

最后,所有的贝塞尔曲线命令可以制作出一个多边贝塞尔图形,先初始化命令,然后多次指定所有的参数,就可以制作出一个多边贝赛尔图形。因此,下面的两个命令可以创建完全相同的路径:

- -
-

<path d="c 50,0 50,100 100,100 50,0 50,-100 100,-100" />
- <path d="c 50,0 50,100 100,100 c 50,0 50,-100 100,-100" />

-
- -

Arcto

- -

有时候描述一个椭圆弧曲线路径要比描述一个贝塞尔曲线路径更简单。说到底,path 元素支持 Arcto 命令。圆弧的中心由别的变量计算出。一个 arcto 的声明相对而言有点复 Visual Studio:”A rx,ry xAxisRotate LargeArcFlag,SweepFlag x,y“。解构它,rx 和 ry 分别是 x 和 y 方向的半径,而 LargeArcFlag 的值要到是 0 要么是 1,用来确定是要画小弧(0)还是画大弧(1)。SweepFlag 也要么是 0 要么是 1,用来确定弧是顺时针方向(1)还是逆时针方向(0)。x 和 y 是目的地的坐标。虽然 xAxisRotate 支持改变 x 轴相对于当前引用框架的方向,但是在 Gecko 7 中,这个参数看起来没什么效果。

- -

ClosePath

- -

ClosePath 命令将在当前路径从,从当前点到第一个点简单画一条直线。它是最简单的命令,而且不带有任何参数。它沿着到开始点的最短的线性路径,如果别的路径落在这路上,将可能路径相交。句法是”Z“或”z“,两种写法作用都一样。

-
- -

元素

- -

以下元素可以使用d属性:

- -
    -
  • {{SVGElement("path")}} »
  • -
  • {{SVGElement("glyph")}} »
  • -
- -

同样的规则可以应用到{{SVGElement("animate")}}动画路径上。

- -

提醒

- -

原点(坐标系 0,0 点)经常是上下文的左上角。然而{{SVGElement("glyph")}}元素的原点在它的字母框的左下角

- -

在任何两个数字之间允许加一个逗号,但是在别的地方不允许加逗号。

- -

示例

- -
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-    	 viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
-    <path fill="#F7931E" d="M37,17v15H14V17H37z M50,0H0v50h50V0z"/>
-</svg>
- -

为了演示d="M37,17v15H14V17H37z M50,0H0v50h50V0z"的实际意义,我们来讨论这个字符串的每一小段。

- -

enter image description here

- -
    -
  • d=" M37,17 || v15 || H14 || V17 || H37 ||z // M50,0 || H0 || v50 || h50 || V0 || z"
  • -
  • d= -
      -
    • 这个属性包含了构成整个 SVG 的字符串。
    • -
    -
  • -
  • M37,17 -
      -
    • M 是 MoveTo 的缩写。大写的“M”意味着绝对坐标,小写的“m”意味着相对距离。它暗含着是基于开始坐标,线在框里面,而且你在方框内矩形的右上角开始。
    • -
    • 37 是开始 svg 位置的缩写,在 X 轴坐标 37 像素处。
    • -
    • 17 开始 svg 位置,在 y 轴的 17 像素处。
    • -
    -
  • -
  • v15 -
      -
    • v 代表垂直。大写的 V 意味着绝对坐标,小写的 v 表示相对的长度、距离。dx/dy 和 x/y 可以用在 H/V 和 h/v 相应的位置里。
    • -
    • 这里是表示相对于给定坐标画一条 15 像素的垂直线。它意味着你向下画 15 像素,到坐标 37,32。
    • -
    -
  • -
  • H14 -
      -
    • H 代表水平,它是绝对坐标,因为它是大写的。
    • -
    • 从 v15 的终点开始,画一条水平线直到到达绝对坐标 14,当到达 x 坐标 14 时结束画线。笔触位于坐标 14,32。
    • -
    -
  • -
  • V17 -
      -
    • 就像前面那样,从上一条线的终点开始,画一条垂直线,直到到达 y 轴坐标 17。笔触位于坐标 14,17。
    • -
    -
  • -
  • H37 -
      -
    • 最后,从 14,17 开始,画一条水平线,直到到达 x 轴坐标 37。笔触位于坐标 37,17(M 的值)
    • -
    -
  • -
  • z -
      -
    • 小写的 z 和大写的 Z 都是闭合一系列 svg 线段。
    • -
    -
  • -
  • , -
      -
    • 逗号开始下一串简单矢量图形线段。下一系列简单矢量线段将制作外层方框。
    • -
    -
  • -
  • M50,0 -
      -
    • 在 x 轴 50 和 y 轴 0 处开始。
    • -
    -
  • -
  • H0 -
      -
    • 画一条直线直到 (0,0)。
    • -
    -
  • -
  • v50 -
      -
    • 相对于 0,0 画一条 50 像素的垂直线。这条线将画到 (0,50)。
    • -
    -
  • -
  • h50 -
      -
    • 相对于 (0,-50) 画一条 50 像素的水平线。这条线将向右画到 (50,50)。
    • -
    -
  • -
  • V0 -
      -
    • 画一条垂直线直到到达 y 轴坐标 0。这将画线到 (50,0),即 M 的值。
    • -
    -
  • -
  • z -
      -
    • 小写的 z 和大写的 Z 都是闭合一系列 svg 线段。
    • -
    -
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/d/index.md b/files/zh-cn/web/svg/attribute/d/index.md new file mode 100644 index 00000000000000..934ff0964ad284 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/d/index.md @@ -0,0 +1,164 @@ +--- +title: d +slug: Web/SVG/Attribute/d +tags: + - SVG + - SVG 元素 + - 参考 +translation_of: Web/SVG/Attribute/d +--- +« [SVG 属性参考主页](/zh-CN/docs/Web/SVG/Attribute) + +该属性定义了一个路径。 + +## 用法 + +| 类别 | 路径定义属性 | +| -------- | --------------------------------------------------------------------------- | +| 值 | | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#DurAttribute) | + +属性`d`实际上是一个字符串,包含了一系列路径描述。这些路径由下面这些指令组成: + +- Moveto +- Lineto +- Curveto +- Arcto +- ClosePath + +这些组合在一个字符串中。这些不同的命令是大小写敏感的;一个大写的命令指明它的参数是绝对位置,而小写的命令指明相对于当前位置的点。可以指定一个负数值作为命令的参数:负角度将是逆时针的,绝对 x 和 y 位置将视为负坐标。负相对 x 值将会往左移,而负相对 y 值将会向上移。 + +## Moveto + +`Moveto`指令可以被想象成拎起绘图笔,落脚到另一处。在上一个点和这个指定点之间没有线段绘制。用一个 Moveto 命令开始一个路径是好的作法,因为如果没有一个初始化的 Moveto,执行命令时开始点会是上一个操作发生过的地方,这样可能造成不确定的行为。 + +句法: + +- `M x,y` 在这里 x 和 y 是绝对坐标,分别代表水平坐标和垂直坐标。 +- `m dx,dy` 在这里 dx 和 dy 是相对于当前点的距离,分别是向右和向下的距离。 + +示例: + +- 位于绝对位置 x=50, y= 100:`` +- 往右移 50,往下移 100:`` + +## Lineto + +和`Moveto`指令不同,`Lineto`指令将绘制一条直线段。这个直线段从当前位置移到指定位置。原生的`Lineto`命令的句法是”L x, y“或者”l dx, dy“,在这里 x 和 y 是绝对坐标,而 dx 和 dy 分别是向右和向下的距离。还有字母 H 和 V,分别指定水平和垂直移动。它们的句法与 L 相同,它的小写版本是相对距离,大写版本是绝对位置。 + +## Curveto + +Curvto 命令指定了一个[贝塞尔曲线](/User:Jt//Sandbox/Curves_in_Paths)。有两种类型的贝塞尔曲线:立方曲线和二次方曲线。二次方贝塞尔曲线是一种特殊的立方贝塞尔曲线,在这里,控制点的两端是相同的。二次方贝塞尔曲线的句法是”Q cx, cy x, y“或”q dcx, dcy dx, dy“。cx 和 cy 都是控制点的绝对坐标,而 dcx 和 dcy 分别是控制点在 x 和 y 方向上的距离。 + +立方贝赛尔曲线遵守二次方贝赛尔曲线同样的概念,但是它需要考虑两个控制点。立方贝塞尔曲线的句法是:”C c1x,c1y c2x,c2y x,y“或者”c dc1x,dc1y dc2x,dc2y dx,dy“,在这里,c1x、c1y 和 c2x、c2y 是分别是初始点和结束点的控制点的绝对坐标。dc1x、dc1y 和 dc2x、dc2y 都是相对于初始点,而不是相对于结束点的。dx 和 dy 分别是向右和向下的距离。 + +为了连缀平滑的贝塞尔曲线,还可以使用 T 和 S 命令。它们的语法比别的 Curveto 命令简单,因为它假定第一个控制点是从前一个控制点关于前一个点的反射,或者说如果没有前一个控制点的话它实际上就是前一个点。T 的句法是”T x,y“或者”t dx,dy“,分别对应于绝对坐标和相对距离,用来创建二次方贝塞尔曲线。S 用来创建立方贝塞尔曲线,语法是”S cx,cy x,y“或者”s dcx,dcy dx,dy“,在这里 (d)cx 指定第二个控制点。 + +最后,所有的贝塞尔曲线命令可以制作出一个多边贝塞尔图形,先初始化命令,然后多次指定所有的参数,就可以制作出一个多边贝赛尔图形。因此,下面的两个命令可以创建完全相同的路径: + +```svg + + +``` + +## Arcto + +有时候描述一个椭圆弧曲线路径要比描述一个贝塞尔曲线路径更简单。说到底,path 元素支持 Arcto 命令。圆弧的中心由别的变量计算出。一个 arcto 的声明相对而言有点复 Visual Studio:”A rx,ry xAxisRotate LargeArcFlag,SweepFlag x,y“。解构它,rx 和 ry 分别是 x 和 y 方向的半径,而 LargeArcFlag 的值要到是 0 要么是 1,用来确定是要画小弧(0)还是画大弧(1)。SweepFlag 也要么是 0 要么是 1,用来确定弧是顺时针方向(1)还是逆时针方向(0)。x 和 y 是目的地的坐标。虽然 xAxisRotate 支持改变 x 轴相对于当前引用框架的方向,但是在 Gecko 7 中,这个参数看起来没什么效果。 + +## ClosePath + +ClosePath 命令将在当前路径从,从当前点到第一个点简单画一条直线。它是最简单的命令,而且不带有任何参数。它沿着到开始点的最短的线性路径,如果别的路径落在这路上,将可能路径相交。句法是”Z“或”z“,两种写法作用都一样。 + +## 元素 + +以下元素可以使用`d`属性: + +- {{SVGElement("path")}} » +- {{SVGElement("glyph")}} » + +同样的规则可以应用到{{SVGElement("animate")}}动画路径上。 + +## 提醒 + +原点(坐标系 0,0 点)经常是上下文的**左上角**。然而{{SVGElement("glyph")}}元素的原点在它的字母框的**左下角**。 + +在任何两个数字之间允许加一个逗号,但是在别的地方不允许加逗号。 + +## 示例 + +```plain + + + +``` + +为了演示`d="M37,17v15H14V17H37z M50,0H0v50h50V0z"的实际意义,我们来讨论这个字符串的每一小段。` + +![enter image description here](http://img3.douban.com/view/photo/large/public/p2316231190.jpg) + +- `d=" M37,17 || v15 || H14 || V17 || H37 ||z // M50,0 || H0 || v50 || h50 || V0 || z"` +- `d=` + + - 这个属性包含了构成整个 SVG 的字符串。 + +- `M37,17` + + - M 是 MoveTo 的缩写。大写的“M”意味着绝对坐标,小写的“m”意味着相对距离。它暗含着是基于开始坐标,线在框里面,而且你在方框内矩形的右上角开始。 + - 37 是开始 svg 位置的缩写,在 X 轴坐标 37 像素处。 + - `17 开始 svg 位置,在 y 轴的 17 像素处。` + +- v15 + + - v 代表垂直。大写的 V 意味着绝对坐标,小写的 v 表示相对的长度、距离。dx/dy 和 x/y 可以用在 H/V 和 h/v 相应的位置里。 + - 这里是表示相对于给定坐标画一条 15 像素的垂直线。它意味着你向下画 15 像素,到坐标 37,32。 + +- `H14` + + - H 代表水平,它是绝对坐标,因为它是大写的。 + - 从 v15 的终点开始,画一条水平线直到到达绝对坐标 14,当到达 x 坐标 14 时结束画线。笔触位于坐标 14,32。 + +- `V17` + + - 就像前面那样,从上一条线的终点开始,画一条垂直线,直到到达 y 轴坐标 17。笔触位于坐标 14,17。 + +- H37 + + - 最后,从 14,17 开始,画一条水平线,直到到达 x 轴坐标 37。笔触位于坐标 37,17(M 的值) + +- `z` + + - 小写的 z 和大写的 Z 都是闭合一系列 svg 线段。 + +- `,` + + - 逗号开始下一串简单矢量图形线段。下一系列简单矢量线段将制作外层方框。 + +- `M50,0` + + - 在 x 轴 50 和 y 轴 0 处开始。 + +- `H0` + + - 画一条直线直到 (0,0)。 + +- `v50` + + - 相对于 0,0 画一条 50 像素的垂直线。这条线将画到 (0,50)。 + +- `h50` + + - 相对于 (0,-50) 画一条 50 像素的水平线。这条线将向右画到 (50,50)。 + +- `V0` + + - 画一条垂直线直到到达 y 轴坐标 0。这将画线到 (50,0),即 M 的值。 + +- `z` + + - 小写的 z 和大写的 Z 都是闭合一系列 svg 线段。 + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/display/index.html b/files/zh-cn/web/svg/attribute/display/index.html deleted file mode 100644 index a12444f0320d5d..00000000000000 --- a/files/zh-cn/web/svg/attribute/display/index.html +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: display -slug: Web/SVG/Attribute/display -translation_of: Web/SVG/Attribute/display ---- -
{{SVGRef}}
- -

The display attribute lets you control the rendering of graphical or container elements.

- -

display属性让你可以控制图形元素或容器元素的渲染。

- -

A value of display="none" indicates that the given element and its children will not be rendered. Any value other than none or inherit indicates that the given element will be rendered by the browser.

- -

display="none"表示该元素和它的子元素不会被渲染。而非noneinherit的值表示元素会被浏览器渲染。

- -

When applied to a container element, setting display to none causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. This means that any child of an element with display="none" will never be rendered even if the child has a value for display other than none.

- -

当应用到容器元素时,将display设为none会导致容器与它所有的子元素不可见,如此看来,它在一组元素中表现地像一个元素组。这表示具有display="none"属性元素的所有子元素都不会被渲染,即使子元素的display并不是none

- -

When the display attribute is set to none, then the given element does not become part of the rendering tree. It has implications for the {{SVGElement("tspan")}}, {{SVGElement("tref")}}, and {{SVGElement("altGlyph")}} elements, event processing, for bounding box calculations and for calculation of clipping paths:

- -

display属性被设为none的元素不会成为渲染树的一部分。它涉及到{{SVGElement("tspan")}}, {{SVGElement("tref")}}, 和 {{SVGElement("altGlyph")}}元素、用于盒边界与路径剪裁计算的事件处理。

- -
    -
  • If display is set to none on a {{SVGElement("tspan")}}, {{SVGElement("tref")}}, or {{SVGElement("altGlyph")}} element, then the text string is ignored for the purposes of text layout.
  • -
- -

如果在{{SVGElement("tspan")}}, {{SVGElement("tref")}}, 或{{SVGElement("altGlyph")}}元素中display的属性值被设为none,则为了文字布局,文字字符串会被忽视掉。

- -
    -
  • Regarding events, if display is set to none, the element receives no events.
  • -
- -

至于事件,如果display被设为none则该元素不接受任何事件。

- -
    -
  • The geometry of a graphics element with display set to none is not included in bounding box and clipping paths calculations.
  • -
- -

图形元素的display属性被设为none则不会被盒边界和路径剪裁计算中包含进去。

- -

The display attribute only affects the direct rendering of a given element, whereas it does not prevent elements from being referenced by other elements. For example, setting it to none on a {{SVGElement("path")}} element will prevent that element from getting rendered directly onto the canvas, but the {{SVGElement("path")}} element can still be referenced by a {{SVGElement("textPath")}} element; furthermore, its geometry will be used in text-on-a-path processing even if the {{SVGElement("path")}} has a display value of none.

- -

display属性只影响能被直接渲染的元素,尽管它不能防止该元素被其他元素参考。例如:将{SVGElement("path")}}元素设为 none,会使得该元素不会被直接渲染到 canvas 上,但是{{SVGElement("textPath")}}元素依旧会参考{{SVGElement("path")}}。此外,即便{SVGElement("path")}}的displaynone,它的形状在处理路径上的文本时仍然会被用到。

- -

This attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. Thus, setting display="none" on a child of a {{SVGElement("mask")}} will prevent the given child element from being rendered as part of the mask. Similarly, setting display="none" on a child of a {{SVGElement("clipPath")}} element will prevent the given child element from contributing to the clipping path.

- -

这个属性也能影响直接渲染到屏幕外的画布,比如遮罩或路径剪裁。因此,把{{SVGElement("mask")}}元素的一个子元素设为display="none"将会阻止子元素参与到路径剪裁中。

- -

Note: As a presentation attribute, display can be used as a CSS property. See {{cssxref("display", "CSS display")}} for further information.

- -

As a presentation attribute, it can be applied to any element.

- -
- - -
<svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg">
-  <!-- Here the yellow rectangle is displayed -->
-  <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect>
-  <rect x="20" y="20" width="60" height="60" fill="yellow"></rect>
-
-  <!-- Here the yellow rectangle is not displayed -->
-  <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect>
-  <rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect>
-</svg>
- -

{{EmbedLiveSample("topExample", "240", "120")}}

-
- -

Usage notes

- - - - - - - - - - - - - - - - -
Default valueinline
Value{{csssyntax("display")}}
AnimatableYes
- -

For a description of the values, please refer to the {{cssxref("display", "CSS display")}} property.

- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

- -

See also

- -
    -
  • {{SVGAttr("visibility")}} attribute
  • -
  • {{cssxref("display", "CSS display")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/display/index.md b/files/zh-cn/web/svg/attribute/display/index.md new file mode 100644 index 00000000000000..da2d76ca21c4ad --- /dev/null +++ b/files/zh-cn/web/svg/attribute/display/index.md @@ -0,0 +1,90 @@ +--- +title: display +slug: Web/SVG/Attribute/display +translation_of: Web/SVG/Attribute/display +--- +{{SVGRef}} + +The **`display`** attribute lets you control the rendering of graphical or container elements. + +**`display`**属性让你可以控制图形元素或容器元素的渲染。 + +A value of `display="none"` indicates that the given element and its children will not be rendered. Any value other than `none` or `inherit` indicates that the given element will be rendered by the browser. + +`display="none"`表示该元素和它的子元素不会被渲染。而非`none`或`inherit`的值表示元素会被浏览器渲染。 + +When applied to a container element, setting `display` to `none` causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. This means that any child of an element with `display="none"` will never be rendered even if the child has a value for `display` other than `none`. + +当应用到容器元素时,将`display`设为`none`会导致容器与它所有的子元素不可见,如此看来,它在一组元素中表现地像一个元素组。这表示具有`display="none"`属性元素的所有子元素都不会被渲染,即使子元素的`display`并不是`none`。 + +When the `display` attribute is set to `none`, then the given element does not become part of the rendering tree. It has implications for the {{SVGElement("tspan")}}, {{SVGElement("tref")}}, and {{SVGElement("altGlyph")}} elements, event processing, for bounding box calculations and for calculation of clipping paths: + +`display`属性被设为`none`的元素不会成为渲染树的一部分。它涉及到{{SVGElement("tspan")}}, {{SVGElement("tref")}}, 和 {{SVGElement("altGlyph")}}元素、用于盒边界与路径剪裁计算的事件处理。 + +- If `display` is set to `none` on a {{SVGElement("tspan")}}, {{SVGElement("tref")}}, or {{SVGElement("altGlyph")}} element, then the text string is ignored for the purposes of text layout. + +如果在{{SVGElement("tspan")}}, {{SVGElement("tref")}}, 或{{SVGElement("altGlyph")}}元素中`display`的属性值被设为`none`,则为了文字布局,文字字符串会被忽视掉。 + +- Regarding events, if `display` is set to `none`, the element receives no events. + +至于事件,如果`display`被设为`none`则该元素不接受任何事件。 + +- The geometry of a [graphics element](/zh-CN/docs/Web/SVG/Element#Graphics_elements) with `display` set to `none` is not included in bounding box and clipping paths calculations. + +图形元素的`display`属性被设为`none`则不会被盒边界和路径剪裁计算中包含进去。 + +The `display` attribute only affects the direct rendering of a given element, whereas it does not prevent elements from being referenced by other elements. For example, setting it to `none` on a {{SVGElement("path")}} element will prevent that element from getting rendered directly onto the canvas, but the {{SVGElement("path")}} element can still be referenced by a {{SVGElement("textPath")}} element; furthermore, its geometry will be used in text-on-a-path processing even if the {{SVGElement("path")}} has a `display` value of `none`. + +`display`属性只影响能被直接渲染的元素,尽管它不能防止该元素被其他元素参考。例如:将{SVGElement("path")}}元素设为 none,会使得该元素不会被直接渲染到 canvas 上,但是{{SVGElement("textPath")}}元素依旧会参考{{SVGElement("path")}}。此外,即便{SVGElement("path")}}的`display`为`none`,它的形状在处理路径上的文本时仍然会被用到。 + +This attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. Thus, setting `display="none"` on a child of a {{SVGElement("mask")}} will prevent the given child element from being rendered as part of the mask. Similarly, setting `display="none"` on a child of a {{SVGElement("clipPath")}} element will prevent the given child element from contributing to the clipping path. + +这个属性也能影响直接渲染到屏幕外的画布,比如遮罩或路径剪裁。因此,把{{SVGElement("mask")}}元素的一个子元素设为`display="none"`将会阻止子元素参与到路径剪裁中。 + +**Note:** As a presentation attribute, `display` can be used as a CSS property. See {{cssxref("display", "CSS display")}} for further information. + +As a presentation attribute, it can be applied to any element. + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + + + + + + + + +``` + +{{EmbedLiveSample("示例", "240", "120")}} + +## Usage notes + +| Default value | `inline` | +| ------------- | -------------------------------- | +| Value | {{csssyntax("display")}} | +| Animatable | Yes | + +For a description of the values, please refer to the {{cssxref("display", "CSS display")}} property. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{SVGAttr("visibility")}} attribute +- {{cssxref("display", "CSS display")}} diff --git a/files/zh-cn/web/svg/attribute/dominant-baseline/index.html b/files/zh-cn/web/svg/attribute/dominant-baseline/index.html deleted file mode 100644 index 1d814c2c0cd3af..00000000000000 --- a/files/zh-cn/web/svg/attribute/dominant-baseline/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: dominant-baseline -slug: Web/SVG/Attribute/dominant-baseline -translation_of: Web/SVG/Attribute/dominant-baseline ---- -

« SVG Attribute reference home

-

The dominant-baseline attribute is used to determine or re-determine a scaled-baseline-table. A scaled-baseline-table is a compound value with three components: a baseline-identifier for the dominant-baseline, a baseline-table and a baseline-table font-size. Some values of the property re-determine all three values; other only re-establish the baseline-table font-size. When the initial value, auto, would give an undesired result, this property can be used to explicitly set the desire scaled-baseline-table.

-

If there is no baseline table in the nominal font or if the baseline table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline.

-

As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see {{ cssxref("dominant-baseline","CSS dominant-baseline") }} for further information.

-

Usage context

- - - - - - - - - - - - - - - - - - - -
CategoriesPresentation attribute
Valueauto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge | inherit
AnimatableYes
Normative documentSVG 1.1 (2nd Edition)
-
-
- auto
-
-

If this property occurs on a {{ SVGElement("text") }} element, then the computed value depends on the value of the {{ SVGAttr("writing-mode") }} attribute. If the {{ SVGAttr("writing-mode") }} is horizontal, then the value of the dominant-baseline component is alphabetic, else if the {{ SVGAttr("writing-mode") }} is vertical, then the value of the dominant-baseline component is central.

-

If this property occurs on a {{ SVGElement("tspan") }}, {{ SVGElement("tref") }}, {{ SVGElement("altGlyph") }} or {{ SVGElement("textPath") }} element, then the dominant-baseline and the baseline-table components remain the same as those of the parent text content element. If the computed {{ SVGAttr("baseline-shift") }} value actually shifts the baseline, then the baseline-table font-size component is set to the value of the {{ SVGAttr("font-size") }} attribute on the element on which the dominant-baseline attribute occurs, otherwise the baseline-table font-size remains the same as that of the element. If there is no parent text content element, the scaled-baseline-table value is constructed as above for {{ SVGElement("text") }} elements.

-
-
- use-script
-
- The dominant-baseline and the baseline-table components are set by determining the predominant script of the character data content. The {{ SVGAttr("writing-mode") }}, whether horizontal or vertical, is used to select the appropriate set of baseline-tables and the dominant baseline is used to select the baseline-table that corresponds to that baseline. The baseline-table font-size component is set to the value of the {{ SVGAttr("font-size") }} attribute on the element on which the dominant-baseline attribute occurs.
-
- no-change
-
- The dominant-baseline, the baseline-table, and the baseline-table font-size remain the same as that of the parent text content element.
-
- reset-size
-
- The dominant-baseline and the baseline-table remain the same, but the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. This re-scales the baseline-table for the current {{ SVGAttr("font-size") }}.
-
- ideographic
-
- The baseline-identifier for the dominant-baseline is set to be ideographic, the derived baseline-table is constructed using the ideographic baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- alphabetic
-
- The baseline-identifier for the dominant-baseline is set to be alphabetic, the derived baseline-table is constructed using the alphabetic baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- hanging
-
- The baseline-identifier for the dominant-baseline is set to be hanging, the derived baseline-table is constructed using the hanging baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- mathematical
-
- The baseline-identifier for the dominant-baseline is set to be mathematical, the derived baseline-table is constructed using the mathematical baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- central
-
- The baseline-identifier for the dominant-baseline is set to be central. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. That font baseline-table is chosen using the following priority order of baseline-table names: ideographic, alphabetic, hanging, mathematical. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- middle
-
- The baseline-identifier for the dominant-baseline is set to be middle. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. That font baseline-table is chosen using the following priority order of baseline-table names: alphabetic, ideographic, hanging, mathematical. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- text-after-edge
-
- The baseline-identifier for the dominant-baseline is set to be text-after-edge. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. The choice of which font baseline-table to use from the baseline-tables in the font is browser dependent. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
- text-before-edge
-
- The baseline-identifier for the dominant-baseline is set to be text-before-edge. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. The choice of which baseline-table to use from the baseline-tables in the font is browser dependent. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element.
-
-

Example

-

Elements

-

The following elements can use the dominant-baseline-shift attribute

- - -

规范

- -{{Specifications}} - -

See also

-
    -
  • {{ cssxref("dominant-baseline","CSS dominant-baseline") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/dominant-baseline/index.md b/files/zh-cn/web/svg/attribute/dominant-baseline/index.md new file mode 100644 index 00000000000000..ebd04690d589e0 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/dominant-baseline/index.md @@ -0,0 +1,61 @@ +--- +title: dominant-baseline +slug: Web/SVG/Attribute/dominant-baseline +translation_of: Web/SVG/Attribute/dominant-baseline +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +The `dominant-baseline` attribute is used to determine or re-determine a scaled-baseline-table. A scaled-baseline-table is a compound value with three components: a baseline-identifier for the dominant-baseline, a baseline-table and a baseline-table font-size. Some values of the property re-determine all three values; other only re-establish the baseline-table font-size. When the initial value, auto, would give an undesired result, this property can be used to explicitly set the desire scaled-baseline-table. + +If there is no baseline table in the nominal font or if the baseline table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline. + +As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see {{ cssxref("dominant-baseline","CSS dominant-baseline") }} for further information. + +## Usage context + +| Categories | Presentation attribute | +| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Value | **auto** \| use-script \| no-change \| reset-size \| ideographic \| alphabetic \| hanging \| mathematical \| central \| middle \| text-after-edge \| text-before-edge \| inherit | +| Animatable | Yes | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/text.html#DominantBaselineProperty) | + +- auto + - : If this property occurs on a {{ SVGElement("text") }} element, then the computed value depends on the value of the {{ SVGAttr("writing-mode") }} attribute. If the {{ SVGAttr("writing-mode") }} is horizontal, then the value of the dominant-baseline component is `alphabetic`, else if the {{ SVGAttr("writing-mode") }} is vertical, then the value of the dominant-baseline component is `central`.If this property occurs on a {{ SVGElement("tspan") }}, {{ SVGElement("tref") }}, {{ SVGElement("altGlyph") }} or {{ SVGElement("textPath") }} element, then the dominant-baseline and the baseline-table components remain the same as those of the parent text content element. If the computed {{ SVGAttr("baseline-shift") }} value actually shifts the baseline, then the baseline-table font-size component is set to the value of the {{ SVGAttr("font-size") }} attribute on the element on which the `dominant-baseline` attribute occurs, otherwise the baseline-table font-size remains the same as that of the element. If there is no parent text content element, the scaled-baseline-table value is constructed as above for {{ SVGElement("text") }} elements. +- use-script + - : The dominant-baseline and the baseline-table components are set by determining the predominant script of the character data content. The {{ SVGAttr("writing-mode") }}, whether horizontal or vertical, is used to select the appropriate set of baseline-tables and the dominant baseline is used to select the baseline-table that corresponds to that baseline. The baseline-table font-size component is set to the value of the {{ SVGAttr("font-size") }} attribute on the element on which the `dominant-baseline` attribute occurs. +- no-change + - : The dominant-baseline, the baseline-table, and the baseline-table font-size remain the same as that of the parent text content element. +- reset-size + - : The dominant-baseline and the baseline-table remain the same, but the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. This re-scales the baseline-table for the current {{ SVGAttr("font-size") }}. +- ideographic + - : The baseline-identifier for the dominant-baseline is set to be `ideographic`, the derived baseline-table is constructed using the `ideographic` baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- alphabetic + - : The baseline-identifier for the dominant-baseline is set to be `alphabetic`, the derived baseline-table is constructed using the `alphabetic` baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- hanging + - : The baseline-identifier for the dominant-baseline is set to be `hanging`, the derived baseline-table is constructed using the `hanging` baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- mathematical + - : The baseline-identifier for the dominant-baseline is set to be `mathematical`, the derived baseline-table is constructed using the `mathematical` baseline-table in the font, and the baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- central + - : The baseline-identifier for the dominant-baseline is set to be `central`. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. That font baseline-table is chosen using the following priority order of baseline-table names: `ideographic`, `alphabetic`, `hanging`, `mathematical`. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- middle + - : The baseline-identifier for the dominant-baseline is set to be `middle`. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. That font baseline-table is chosen using the following priority order of baseline-table names: `alphabetic`, `ideographic`, `hanging`, `mathematical`. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- text-after-edge + - : The baseline-identifier for the dominant-baseline is set to be `text-after-edge`. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. The choice of which font baseline-table to use from the baseline-tables in the font is browser dependent. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. +- text-before-edge + - : The baseline-identifier for the dominant-baseline is set to be `text-before-edge`. The derived baseline-table is constructed from the defined baselines in a baseline-table in the font. The choice of which baseline-table to use from the baseline-tables in the font is browser dependent. The baseline-table font-size is changed to the value of the {{ SVGAttr("font-size") }} attribute on this element. + +## Example + +## Elements + +The following elements can use the `dominant-baseline-shift` attribute + +- [Text content elements](/en/SVG/Element#Text_content_elements) » + +## 规范 + +{{Specifications}} + +## See also + +- {{ cssxref("dominant-baseline","CSS dominant-baseline") }} diff --git a/files/zh-cn/web/svg/attribute/dur/index.html b/files/zh-cn/web/svg/attribute/dur/index.html deleted file mode 100644 index 568c4265d67698..00000000000000 --- a/files/zh-cn/web/svg/attribute/dur/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: dur -slug: Web/SVG/Attribute/dur -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/dur ---- -

« SVG 属性参考主页

- -

该属性标识了动画的简单持续时间。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画定时属性
<clock-value> | indefinite
可变性No
规范文档SVG 1.1 (2nd Edition)
- -
-
<clock-value>
-
指定简单持续时间的时长。值必须大于 0。可以用小时(h)、分钟(m)、秒(s)、毫秒(ms)表达这个值。可以组合这些时间表达式以提供一个复合的持续时间,比如这样:hh:mm:ss.iii或者这样:mm:ss.iii
-
- -

如果一个动画元素不带有dur属性,简单持续时间就是无限期的。请注意:如果一个简单持续时间是无限期的,则插值不能起作用(虽然它对 {{ SVGElement("set") }} 元素依然是有用的)。

- -

示例

- -

元素

- -

下列元素可以使用dur属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/dur/index.md b/files/zh-cn/web/svg/attribute/dur/index.md new file mode 100644 index 00000000000000..411556c1a76772 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/dur/index.md @@ -0,0 +1,37 @@ +--- +title: dur +slug: Web/SVG/Attribute/dur +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/dur +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性标识了动画的简单持续时间。 + +## 用法 + +| 类别 | 动画定时属性 | +| -------- | --------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Clock-value) \| **indefinite** | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#DurAttribute) | + +- [\](/en/SVG/Content_type#Clock-value) + - : 指定简单持续时间的时长。值必须大于 0。可以用小时(h)、分钟(m)、秒(s)、毫秒(ms)表达这个值。可以组合这些时间表达式以提供一个复合的持续时间,比如这样:`hh:mm:ss.iii`或者这样:`mm:ss.iii`。 + +如果一个动画元素不带有`dur`属性,简单持续时间就是无限期的。请注意:如果一个简单持续时间是无限期的,则插值不能起作用(虽然它对 {{ SVGElement("set") }} 元素依然是有用的)。 + +## 示例 + +## 元素 + +下列元素可以使用`dur`属性: + +- [动画元素](/en/SVG/Element#Animation) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/dx/index.html b/files/zh-cn/web/svg/attribute/dx/index.html deleted file mode 100644 index f2da6f2feff35f..00000000000000 --- a/files/zh-cn/web/svg/attribute/dx/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: dx -slug: Web/SVG/Attribute/dx -tags: - - SVG - - SVG 标签 -translation_of: Web/SVG/Attribute/dx ---- -

« SVG 属性参考汇总

- -

dx 属性表示一个元素或其内容在 x 轴方向上的偏移,偏移量取决于设置该属性的元素。

- -

对于{{SVGElement("feOffset")}}元素,它的值代表所有输入的图像的偏移量之和。这个总和被表达在由{{SVGElement("filter")}}元素的{{SVGAttr("primitiveUnits")}}属性定义的坐标系中。

- -

对于{{SVGElement("glyphRef")}}元素,它的值代表该符号在字体坐标系中 x 轴上的相对坐标。

- -

对于{{SVGElement("text")}}、{{SVGElement("tspan")}}、{{SVGElement("tref")}}和{{SVGElement("altGlyph")}}元素,由于这些元素允许设置<list-of-length>,所以更复杂。

- -

如果只提供了一个<length>,当前文本位置会沿着坐标系内 x 轴方向偏移<length>

- -

如果提供了一个由逗号或者空格分隔的<length>列表,列表中的值将会表示前 n 个字符沿 x 轴方向偏移的增量。因此,当前文本位置也因为绘制当前{{SVGElement("text")}}元素而沿 x 轴方向偏移。

- -

如果在<length>列表中有更多的字符,那么对于每个字符,都有

- -
    -
  • 如果祖先{{SVGElement("text")}}或{{SVGElement("tspan")}}元素对于给定的字符,通过 dx 的属性指定了相对 x 坐标,那么当前文本位置会沿坐标系的 x 轴方向偏移该数值(最近的祖先具有优先级)
  • -
  • 否则没有额外的 x 轴方向的偏移发生
  • -
- -

用法上下文

- - - - - - - - - - - - - - - - - - - - -
分类
数值类型<number> | T<.2Fvar>s"><list-of-length>
可变
规范文档SVG 1.1 (2nd Edition): altGlyph element
- SVG 1.1 (2nd Edition): feOffset element
- SVG 1.1 (2nd Edition): glyphRef element
- SVG 1.1 (2nd Edition): text element
- SVG 1.1 (2nd Edition): tspan element
- -

元素

- -

这些元素可以使用 dx 属性

- -
    -
  • {{ SVGElement("altGlyph") }}
  • -
  • {{ SVGElement("feOffset") }}
  • -
  • {{ SVGElement("glyphRef") }}
  • -
  • {{ SVGElement("text") }}
  • -
  • {{ SVGElement("tref") }}
  • -
  • {{ SVGElement("tspan") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/dx/index.md b/files/zh-cn/web/svg/attribute/dx/index.md new file mode 100644 index 00000000000000..cca9f9be5b09c6 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/dx/index.md @@ -0,0 +1,49 @@ +--- +title: dx +slug: Web/SVG/Attribute/dx +tags: + - SVG + - SVG 标签 +translation_of: Web/SVG/Attribute/dx +--- +« [SVG 属性参考汇总](/en/SVG/Attribute) + +`dx 属性表示一个元素或其内容在 x 轴方向上的偏移,偏移量取决于设置该属性的元素。` + +对于{{SVGElement("feOffset")}}元素,它的值代表所有输入的图像的偏移量之和。这个总和被表达在由{{SVGElement("filter")}}元素的{{SVGAttr("primitiveUnits")}}属性定义的坐标系中。 + +对于{{SVGElement("glyphRef")}}元素,它的值代表该符号在字体坐标系中 x 轴上的相对坐标。 + +对于{{SVGElement("text")}}、{{SVGElement("tspan")}}、{{SVGElement("tref")}}和{{SVGElement("altGlyph")}}元素,由于这些元素允许设置[\](/en/SVG/Content_type#List-of-Ts),所以更复杂。 + +如果只提供了一个[\](/en/SVG/Content_type#Length),当前文本位置会沿着坐标系内 x 轴方向偏移[\](/en/SVG/Content_type#Length) 。 + +如果提供了一个由逗号或者空格分隔的[\](/en/SVG/Content_type#Length)列表,列表中的值将会表示前 n 个字符沿 x 轴方向偏移的增量。因此,当前文本位置也因为绘制当前{{SVGElement("text")}}元素而沿 x 轴方向偏移。 + +如果在[\](/en/SVG/Content_type#Length)列表中有更多的字符,那么对于每个字符,都有 + +- 如果祖先{{SVGElement("text")}}或{{SVGElement("tspan")}}元素对于给定的字符,通过 dx 的属性指定了相对 x 坐标,那么当前文本位置会沿坐标系的 x 轴方向偏移该数值(最近的祖先具有优先级) +- 否则没有额外的 x 轴方向的偏移发生 + +## 用法上下文 + +| 分类 | 无 | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 数值类型 | [](/en/SVG/Content_type#Number) \| [T<.2Fvar>s">](/en/SVG/Content_type#List-of-T<.2Fvar>s) | +| 可变 | 是 | +| 规范文档 | [SVG 1.1 (2nd Edition): altGlyph element](http://www.w3.org/TR/SVG11/text.html#AltGlyphElementDXAttribute) [SVG 1.1 (2nd Edition): feOffset element](http://www.w3.org/TR/SVG11/filters.html#feOffsetDxAttribute) [SVG 1.1 (2nd Edition): glyphRef element](http://www.w3.org/TR/SVG11/text.html#GlyphRefElementDXAttribute) [SVG 1.1 (2nd Edition): text element](http://www.w3.org/TR/SVG11/text.html#TextElementDXAttribute) [SVG 1.1 (2nd Edition): tspan element](http://www.w3.org/TR/SVG11/text.html#TSpanElementDXAttribute) | + +## 元素 + +这些元素可以使用 dx 属性 + +- {{ SVGElement("altGlyph") }} +- {{ SVGElement("feOffset") }} +- {{ SVGElement("glyphRef") }} +- {{ SVGElement("text") }} +- {{ SVGElement("tref") }} +- {{ SVGElement("tspan") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/edgemode/index.html b/files/zh-cn/web/svg/attribute/edgemode/index.html deleted file mode 100644 index c36cdfa55218c5..00000000000000 --- a/files/zh-cn/web/svg/attribute/edgemode/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: edgeMode -slug: Web/SVG/Attribute/edgeMode -tags: - - SVG - - SVG 属性 - - 滤镜 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/edgeMode ---- -

« SVG 属性参考主页

- -

edgeMode属性确定了当核心位于输入图像的边缘或贴近输入图像的边缘时,如何取用颜色值用于扩展输入图像,从而可以应用矩阵操作。

- -

如果没有指定edgeMode属性,等效于值被指定为duplicate

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别
duplicate | wrap | none
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -
-
duplicate
-
它指示输入图像沿着每条边扩展,复制输入图像的给定边缘上的颜色值。
-
wrap
-
它指示扩展输入图像,从图像相对的边缘取色。
-
none
-
它指示扩展输入图像,用 0 作为 RGBA 的像素值。
-
- -

示例

- -

元素

- -

以下元素可以使用edgeMode属性:

- -
    -
  • {{ SVGElement("feConvolveMatrix") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/edgemode/index.md b/files/zh-cn/web/svg/attribute/edgemode/index.md new file mode 100644 index 00000000000000..8ba5aa520e2adc --- /dev/null +++ b/files/zh-cn/web/svg/attribute/edgemode/index.md @@ -0,0 +1,43 @@ +--- +title: edgeMode +slug: Web/SVG/Attribute/edgeMode +tags: + - SVG + - SVG 属性 + - 滤镜 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/edgeMode +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`edgeMode`属性确定了当核心位于输入图像的边缘或贴近输入图像的边缘时,如何取用颜色值用于扩展输入图像,从而可以应用矩阵操作。 + +如果没有指定`edgeMode`属性,等效于值被指定为`duplicate`。 + +## 用法 + +| 类别 | 无 | +| -------- | --------------------------------------------------------------------------------------------------------- | +| 值 | **duplicate** \| wrap \| none | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#feConvolveMatrixElementEdgeModeAttribute) | + +- duplicate + - : 它指示输入图像沿着每条边扩展,复制输入图像的给定边缘上的颜色值。 +- wrap + - : 它指示扩展输入图像,从图像相对的边缘取色。 +- none + - : 它指示扩展输入图像,用 0 作为 RGBA 的像素值。 + +## 示例 + +## 元素 + +以下元素可以使用`edgeMode`属性: + +- {{ SVGElement("feConvolveMatrix") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/enable-background/index.html b/files/zh-cn/web/svg/attribute/enable-background/index.html deleted file mode 100644 index ae270d3938f146..00000000000000 --- a/files/zh-cn/web/svg/attribute/enable-background/index.html +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: enable-background -slug: Web/SVG/Attribute/enable-background -translation_of: Web/SVG/Attribute/enable-background ---- -
{{SVGRef}} {{deprecated_header("SVG 2")}}
- -

enable-background属性指定如何管理背景图像的累积。

- -

注意:作为演示文稿属性,enable-background可以用作 CSS 属性。

- -

作为表示属性,它可以应用于任何元素,但仅对以下 11 个元素有效:{{SVGElement("a")}},{{SVGElement("defs")}},{{SVGElement("字形")}},{{SVGElement("g")}},{{SVGElement("marker")}},{{SVGElement("mask")}},{{SVGElement("missing-glyph")}},{{SVGElement("pattern")}},{{SVGElement("svg")}},{{SVGElement("switch")}}和{{SVGElement("symbol")}}}

- -

上下文注释

- - - - - - - - - - - - - - - - -
accumulate| new[ <x> <y> <width> <height>]?
默认值accumulate
可动画的没有
- -
-
accumulate
-
-

如果祖先容器元素的属性值为enable-background: new,则当前容器元素内的所有图形元素都将呈现到父容器元素的背景图像画布上以及目标设备上。

- -

否则,没有当前的背景图像画布,因此图形元素仅渲染到目标设备上。

-
-
new [ <x> <y> <width> <height> ]?
-
-

该值使当前容器元素的子代能够访问背景图像。

- -

它还指示建立了新的(即最初为透明的黑色)背景图像画布,并且实际上,除了将当前容器元素的所有子对象呈现到目标设备上之外,还应将其呈现到新的背景图像画布中。

- -

The optional <x>, <y>, <width>, and <height> parameters are <number> values that indicate the subregion of the container elementʼs user space where access to the background image is allowed to happen. Those values act as a clipping rectangle on the background image canvas.
- Negative values for <width> or <height> are forbidden. If one, two, or three values are specified or if neither <width> nor <height> are specified, the BackgroundImage and BackgroundAlpha of a filter primitive are processed as if background image processing were not enabled.

-
-
- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/enable-background/index.md b/files/zh-cn/web/svg/attribute/enable-background/index.md new file mode 100644 index 00000000000000..0c58f0bdeb697c --- /dev/null +++ b/files/zh-cn/web/svg/attribute/enable-background/index.md @@ -0,0 +1,33 @@ +--- +title: enable-background +slug: Web/SVG/Attribute/enable-background +translation_of: Web/SVG/Attribute/enable-background +--- +{{SVGRef}} {{deprecated_header("SVG 2")}} + +该**`enable-background`**属性指定如何管理背景图像的累积。 + +**注意:**作为演示文稿属性,`enable-background`可以用作 CSS 属性。 + +作为表示属性,它可以应用于任何元素,但仅对以下 11 个元素有效:{{SVGElement("a")}},{{SVGElement("defs")}},{{SVGElement("字形")}},{{SVGElement("g")}},{{SVGElement("marker")}},{{SVGElement("mask")}},{{SVGElement("missing-glyph")}},{{SVGElement("pattern")}},{{SVGElement("svg")}},{{SVGElement("switch")}}和{{SVGElement("symbol")}}} + +## 上下文注释 + +| 值 | `accumulate`\| `new`[ `` `` `` ``]? | +| -------- | --------------------------------------------------------- | +| 默认值 | `accumulate` | +| 可动画的 | 没有 | + +- `accumulate` + - : 如果祖先容器元素的属性值为`enable-background: new`,则当前容器元素内的所有图形元素都将呈现到父容器元素的背景图像画布上以及目标设备上。否则,没有当前的背景图像画布,因此图形元素仅渲染到目标设备上。 +- `new [ ]?` + - : 该值使当前容器元素的子代能够访问背景图像。它还指示建立了新的(即最初为透明的黑色)背景图像画布,并且实际上,除了将当前容器元素的所有子对象呈现到目标设备上之外,还应将其呈现到新的背景图像画布中。The optional ``, ``, ``, and `` parameters are [``](/en-US/docs/Web/SVG/Content_type#Number) values that indicate the subregion of the container elementʼs user space where access to the background image is allowed to happen. Those values act as a clipping rectangle on the background image canvas. + Negative values for `` or `` are forbidden. If one, two, or three values are specified or if neither `` nor `` are specified, the `BackgroundImage` and `BackgroundAlpha` of a filter primitive are processed as if background image processing were not enabled. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/end/index.html b/files/zh-cn/web/svg/attribute/end/index.html deleted file mode 100644 index 30307596b8e8c6..00000000000000 --- a/files/zh-cn/web/svg/attribute/end/index.html +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: end -slug: Web/SVG/Attribute/end -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/end ---- -

« SVG 属性参考主页

- -

这个属性定义了一个动画的结束值,可以约束激活持续时间。

- -

这个属性值是一个分号分隔的数列值。每个单独值可以是定义在{{ SVGAttr("begin") }}属性中同种类型。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画定时属性
<End-value-list>
可变性No
规范文档SVG 1.1 (2nd Edition)
- -

欲知在<end-value-list>中允许用哪些值,请阅读{{ SVGAttr("begin") }}属性。

- -

示例

- -

元素

- -

下列元素可以使用end属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/end/index.md b/files/zh-cn/web/svg/attribute/end/index.md new file mode 100644 index 00000000000000..3aab401ebaa0dc --- /dev/null +++ b/files/zh-cn/web/svg/attribute/end/index.md @@ -0,0 +1,36 @@ +--- +title: end +slug: Web/SVG/Attribute/end +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/end +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +这个属性定义了一个动画的结束值,可以约束激活持续时间。 + +这个属性值是一个分号分隔的数列值。每个单独值可以是定义在{{ SVGAttr("begin") }}属性中同种类型。 + +## 用法 + +| 类别 | 动画定时属性 | +| -------- | --------------------------------------------------------------------------- | +| 值 | | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#EndAttribute) | + +欲知在``中允许用哪些值,请阅读{{ SVGAttr("begin") }}属性。 + +## 示例 + +## 元素 + +下列元素可以使用`end`属性: + +- [Animation elements](/en/SVG/Element#Animation) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fill-opacity/index.html b/files/zh-cn/web/svg/attribute/fill-opacity/index.html deleted file mode 100644 index 179c5b3a2d2ea6..00000000000000 --- a/files/zh-cn/web/svg/attribute/fill-opacity/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: fill-opacity -slug: Web/SVG/Attribute/fill-opacity -tags: - - SVG - - SVG 属性 - - 参考 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/fill-opacity ---- -

« SVG 属性参考主页

- -

该属性指定了填色的不透明度或当前对象的内容物的不透明度。

- -

用法

- - - - - - - - - - - - - - - - - - - - - - - - -
类别外观属性
<opacity-value> | inherit
初始值1
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -

示例

- -

元素

- -

下列元素可以使用fill-opacity属性:

- - - -

规范

- -{{Specifications}} - -

参见

- -
    -
  • {{ SVGAttr("stroke-opacity") }}
  • -
  • {{ SVGAttr("opacity") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/fill-opacity/index.md b/files/zh-cn/web/svg/attribute/fill-opacity/index.md new file mode 100644 index 00000000000000..770f1ec51e63a8 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fill-opacity/index.md @@ -0,0 +1,40 @@ +--- +title: fill-opacity +slug: Web/SVG/Attribute/fill-opacity +tags: + - SVG + - SVG 属性 + - 参考 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/fill-opacity +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性指定了填色的不透明度或当前对象的内容物的不透明度。 + +## 用法 + +| 类别 | 外观属性 | +| -------- | ----------------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Opacity_value) \| inherit | +| 初始值 | 1 | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/painting.html#FillOpacityProperty) | + +## 示例 + +## 元素 + +下列元素可以使用`fill-opacity`属性: + +- [元素元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ SVGAttr("stroke-opacity") }} +- {{ SVGAttr("opacity") }} diff --git a/files/zh-cn/web/svg/attribute/fill-rule/index.html b/files/zh-cn/web/svg/attribute/fill-rule/index.html deleted file mode 100644 index 2a24c696bf46bf..00000000000000 --- a/files/zh-cn/web/svg/attribute/fill-rule/index.html +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: fill-rule -slug: Web/SVG/Attribute/fill-rule -tags: - - SVG - - SVG 属性 - - 参考 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/fill-rule ---- -

« SVG 属性参考主页

- -

fill-rule 是一个外观属性,它定义了用来确定一个多边形内部区域的算法。

- -
-

注意:作为一个外观属性,fill-rule 可以被用于 CSS。

-
- -

作为一个外观属性,它可以被应用于任何元素,但只会在这八个元素中有效:{{SVGElement('altGlyph')}}、{{SVGElement('path')}}、{{SVGElement('polygon')}}、{{SVGElement('polyline')}}、{{SVGElement('text')}}、{{SVGElement('textPath')}}、{{SVGElement('tref')}} 和 {{SVGElement('tspan')}}。

- -

如何判断一个路径组成的多边形的内部区域,从而给它上色,对于一个简单的、没有交错的路径来说,是很显然的;然而,对于一个更为复杂的路径,比如一条与自身相交的路径,或者是这条路径上的其中一段将另一段包围着,要解释什么是“内部”,就不再这么显然了。

- -
- - -
<svg viewBox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg">
-  <!-- fill-rule 的默认值 -->
-  <polygon fill-rule="nonzero" stroke="red"
-   points="50,0 21,90 98,35 2,35 79,90"/>
-
-  <!--
-  从这个形状的中心到无穷远处有两条路径段(红色部分),因此
-  该区域被认为是形状外部,并且没有被填充。
-  -->
-  <polygon fill-rule="evenodd" stroke="red"
-   points="150,0 121,90 198,35 102,35 179,90"/>
-</svg>
- -

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

-
- -

用法

- - - - - - - - - - - - - - - - - - - - - - - - -
类别外观属性
nonzero | evenodd
默认值nonzero
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -

fill-rule 属性为如何确定一个形状的内部(即可以被填充的区域)提供了两个可选值:

- -
-
-

nonzero

-
-
- -

这个值确定了某点属于该形状的“内部”还是“外部”:从该点向任意方向的无限远处绘制射线,然后检测形状与射线相交的位置。从 0 开始统计,路径上每一条从左到右(顺时针)跨过射线的线段都会让结果加 1,每条从右向左(逆时针)跨过射线的线段都会让结果减 1。当统计结束后,如果结果为 0,则点在外部;如果结果不为 0,则点在内部。

- -

Example

- -
- - -
<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
-  <!-- nonzero 填充规则被用于路径段会相交的形状上的效果 -->
-  <polygon fill-rule="nonzero" stroke="red"
-           points="50,0 21,90 98,35 2,35 79,90"/>
-
-  <!--
-  nonzero 填充规则被用于一个形状在另一形状内部的效果
-  这两个正方形的路径段方向相同(都是顺时针)
-  -->
-  <path fill-rule="nonzero" stroke="red"
-        d="M110,0  h90 v90 h-90 z
-           M130,20 h50 v50 h-50 z"/>
-
-  <!--
-  这个例子与第二个例子几乎相同,唯一的区别是:两个形状的路径段方向相反
-  外面的正方形是顺时针,里面的正方形则是逆时针
-  -->
-  <path fill-rule="nonzero" stroke="red"
-        d="M210,0  h90 v90 h-90 z
-           M230,20 v50 h50 v-50 z"/>
-</svg>
-
- -

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

- -
-
-

evenodd

-
-
- -

这个值用确定了某点属于该形状的“内部”还是“外部”:从该点向任意方向无限远处绘制射线,并统计这个形状所有的路径段中,与射线相交的路径段的数量。如果有奇数个路径段与射线相交,则点在内部;如果有偶数个,则点在外部。

- -

Example

- -
- - -
<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
-  <!-- evenodd 填充规则被用于路径段会相交的形状上的效果 -->
-  <polygon fill-rule="evenodd" stroke="red"
-           points="50,0 21,90 98,35 2,35 79,90"/>
-
-  <!--
-  evenodd 填充规则被用于一个形状在另一形状内部的效果
-  这两个正方形的路径段方向相同(都是顺时针)
-  -->
-  <path fill-rule="evenodd" stroke="red"
-        d="M110,0  h90 v90 h-90 z
-           M130,20 h50 v50 h-50 z"/>
-
-  <!--
-  这个例子与第二个例子几乎相同,唯一的区别是:两个形状的路径段方向相反
-  外面的正方形是顺时针,里面的正方形则是逆时针
-  -->
-  <path fill-rule="evenodd" stroke="red"
-        d="M210,0  h90 v90 h-90 z
-           M230,20 v50 h50 v-50 z"/>
-</svg>
-
- -

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

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/fill-rule/index.md b/files/zh-cn/web/svg/attribute/fill-rule/index.md new file mode 100644 index 00000000000000..6619ba423eaa24 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fill-rule/index.md @@ -0,0 +1,134 @@ +--- +title: fill-rule +slug: Web/SVG/Attribute/fill-rule +tags: + - SVG + - SVG 属性 + - 参考 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/fill-rule +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +**`fill-rule`** 是一个外观属性,它定义了用来确定一个多边形内部区域的算法。 + +> **备注:** 作为一个外观属性,fill-rule 可以被用于 CSS。 + +作为一个外观属性,它可以被应用于任何元素,但只会在这八个元素中有效:{{SVGElement('altGlyph')}}、{{SVGElement('path')}}、{{SVGElement('polygon')}}、{{SVGElement('polyline')}}、{{SVGElement('text')}}、{{SVGElement('textPath')}}、{{SVGElement('tref')}} 和 {{SVGElement('tspan')}}。 + +如何判断一个路径组成的多边形的内部区域,从而给它上色,对于一个简单的、没有交错的路径来说,是很显然的;然而,对于一个更为复杂的路径,比如一条与自身相交的路径,或者是这条路径上的其中一段将另一段包围着,要解释什么是“内部”,就不再这么显然了。 + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## 用法 + +| 类别 | 外观属性 | +| -------- | -------------------------------------------------------------------------------- | +| 值 | nonzero \| evenodd | +| 默认值 | nonzero | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/painting.html#FillRuleProperty) | + +`fill-rule` 属性为如何确定一个形状的内部(即可以被填充的区域)提供了两个可选值: + +### nonzero + +这个值确定了某点属于该形状的“内部”还是“外部”:从该点向任意方向的无限远处绘制射线,然后检测形状与射线相交的位置。从 0 开始统计,路径上每一条从左到右(顺时针)跨过射线的线段都会让结果加 1,每条从右向左(逆时针)跨过射线的线段都会让结果减 1。当统计结束后,如果结果为 0,则点在外部;如果结果不为 0,则点在内部。 + +#### Example + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + +``` + +{{EmbedLiveSample('nonzero', '100%', 200)}} + +### evenodd + +这个值用确定了某点属于该形状的“内部”还是“外部”:从该点向任意方向无限远处绘制射线,并统计这个形状所有的路径段中,与射线相交的路径段的数量。如果有奇数个路径段与射线相交,则点在内部;如果有偶数个,则点在外部。 + +#### Example + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + +``` + +{{EmbedLiveSample('evenodd', '100%', 200)}} + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/fill/index.html b/files/zh-cn/web/svg/attribute/fill/index.html deleted file mode 100644 index de0b1d8ea6742f..00000000000000 --- a/files/zh-cn/web/svg/attribute/fill/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: fill -slug: Web/SVG/Attribute/fill -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/fill ---- -

« SVG 属性参考主页

- -

fill属性根据它的使用环境,拥有两个意义。

- -

默认地,当动画元素结束时,目标元素的外观属性不再应用该效果。在动画元素结束后,要还保持这个动画的的值,就需要用到fill属性。

- -

对于形状元素和文本,fill属性是外观属性,用来定义给定图形元素内部的颜色。哪一块算是“内部”取决于形状本身以及{{ SVGAttr("fill-rule") }} 属性的值。作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。

- -

用法

- -

对动画元素

- - - - - - - - - - - - - - - - - - - - -
类别动画定时属性
remove | freeze
可变性No
规范文档SVG 1.1 (2nd Edition)
- -
-
remove(默认值)
-
在动画的激活持续时间结束后,动画效果会移除(不再应用)。在动画的激活结束后,动画不再对目标元素有影响(除非动画重新开始)。
-
freeze
-
在动画激活持续时间结束后,文档持续时间的剩余时间里(或者直到动画重新开始)动画效果会“冻结”着。
-
- -

对形状元素

- - - - - - - - - - - - - - - - - - - - -
类别外观属性
<paint>
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -

示例

- -

元素

- -

下列元素可以使用fill属性:

- - diff --git a/files/zh-cn/web/svg/attribute/fill/index.md b/files/zh-cn/web/svg/attribute/fill/index.md new file mode 100644 index 00000000000000..11ab9b7123179f --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fill/index.md @@ -0,0 +1,49 @@ +--- +title: fill +slug: Web/SVG/Attribute/fill +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/fill +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`fill`属性根据它的使用环境,拥有两个意义。 + +默认地,当动画元素结束时,目标元素的外观属性不再应用该效果。在动画元素结束后,要还保持这个动画的的值,就需要用到`fill`属性。 + +对于形状元素和文本,`fill`属性是外观属性,用来定义给定图形元素内部的颜色。哪一块算是“内部”取决于形状本身以及{{ SVGAttr("fill-rule") }} 属性的值。作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。 + +## 用法 + +### 对动画元素 + +| 类别 | 动画定时属性 | +| -------- | ---------------------------------------------------------------------------- | +| 值 | **remove** \| freeze | +| 可变性 | No | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#FillAttribute) | + +- remove(默认值) + - : 在动画的激活持续时间结束后,动画效果会移除(不再应用)。在动画的激活结束后,动画不再对目标元素有影响(除非动画重新开始)。 +- freeze + - : 在动画激活持续时间结束后,文档持续时间的剩余时间里(或者直到动画重新开始)动画效果会“冻结”着。 + +### 对形状元素 + +| 类别 | 外观属性 | +| -------- | ---------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Paint) | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/painting.html#FillProperty) | + +## 示例 + +## 元素 + +下列元素可以使用`fill`属性: + +- [动画元素](/en/SVG/Element#Animation_elements) » +- [形状元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » diff --git a/files/zh-cn/web/svg/attribute/filter/index.html b/files/zh-cn/web/svg/attribute/filter/index.html deleted file mode 100644 index 509810dc2cd6ba..00000000000000 --- a/files/zh-cn/web/svg/attribute/filter/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: filter -slug: Web/SVG/Attribute/filter -tags: - - SVG - - SVG 过滤器 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/filter ---- -

« SVG 属性参考主页

- -

属性filter定义了由{{ SVGElement("filter") }}元素定义滤镜效果,该滤镜效果将应用到该元素上。

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。请阅读{{ cssxref("filter","CSS filter") }}以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别外观属性
<funciri> | none | inherit
可变性Yes
规范文档SVG 1.1 (2nd Edition)
- -
-
<funciri>
-
元素的引用,它定义了将要应用到该元素的滤镜效果。
-
none
-
不对该元素应用任何滤镜效果。
-
- -

元素

- -

下列元素可以使用filter属性:

- -
    -
  • 图形元素 »
  • -
  • {{ SVGElement("a") }}
  • -
  • {{ SVGElement("defs") }}
  • -
  • {{ SVGElement("glyph") }}
  • -
  • {{ SVGElement("g") }}
  • -
  • {{ SVGElement("marker") }}
  • -
  • {{ SVGElement("missing-glyph") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("switch") }}
  • -
  • {{ SVGElement("symbol") }}
  • -
- -

规范

- -{{Specifications}} - -

参见

- -
    -
  • {{ cssxref("filter","CSS filter") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/filter/index.md b/files/zh-cn/web/svg/attribute/filter/index.md new file mode 100644 index 00000000000000..f7ac39ec5681d9 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/filter/index.md @@ -0,0 +1,51 @@ +--- +title: filter +slug: Web/SVG/Attribute/filter +tags: + - SVG + - SVG 过滤器 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/filter +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +属性`filter`定义了由{{ SVGElement("filter") }}元素定义滤镜效果,该滤镜效果将应用到该元素上。 + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。请阅读{{ cssxref("filter","CSS filter") }}以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| -------- | ------------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#FuncIRI) \| **none** \| inherit | +| 可变性 | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#FilterProperty) | + +- [\](/en/SVG/Content_type#FuncIRI) + - : 元素的引用,它定义了将要应用到该元素的滤镜效果。 +- none + - : 不对该元素应用任何滤镜效果。 + +## 元素 + +下列元素可以使用`filter`属性: + +- [图形元素](/en/SVG/Element#Graphics_elements) » +- {{ SVGElement("a") }} +- {{ SVGElement("defs") }} +- {{ SVGElement("glyph") }} +- {{ SVGElement("g") }} +- {{ SVGElement("marker") }} +- {{ SVGElement("missing-glyph") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("switch") }} +- {{ SVGElement("symbol") }} + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ cssxref("filter","CSS filter") }} diff --git a/files/zh-cn/web/svg/attribute/filterunits/index.html b/files/zh-cn/web/svg/attribute/filterunits/index.html deleted file mode 100644 index b745ae879297d8..00000000000000 --- a/files/zh-cn/web/svg/attribute/filterunits/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: filterUnits -slug: Web/SVG/Attribute/filterUnits -translation_of: Web/SVG/Attribute/filterUnits ---- -

« SVG Attribute reference home

- -

filterUnits 属性定义{{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和{{ SVGAttr("height") }}使用的坐标系系统。

- -

如果 filterUnits 属性未指定,那么效果如同指定了值为objectBoundingBox.

- -

Usage context

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
ValueuserSpaceOnUse | objectBoundingBox
AnimatableYes
Normative documentSVG 1.1 (2nd Edition)
- -
-
userSpaceOnUse
-
{{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和 {{ SVGAttr("height") }} 表示当前坐标系统中的值,这些值表示{{ SVGElement("filter") }}元素在当前用户坐标系中的位置和大小 (例如通过{{ SVGAttr("filter") }}引用该{{ SVGElement("filter") }}元素的元素所在的坐标系系统).
-
objectBoundingBox
-
在这种情况下,{{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和 {{ SVGAttr("height") }}biao 表示引用{{ SVGElement("filter") }}元素的元素的 baow 包围盒的分数或百分比。
-
- -

Examples

- -

Elements

- -

下面这些元素可以使用 filterUnits 属性:

- -
    -
  • {{ SVGElement("filter") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/filterunits/index.md b/files/zh-cn/web/svg/attribute/filterunits/index.md new file mode 100644 index 00000000000000..578acf1d97eed3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/filterunits/index.md @@ -0,0 +1,35 @@ +--- +title: filterUnits +slug: Web/SVG/Attribute/filterUnits +translation_of: Web/SVG/Attribute/filterUnits +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +filterUnits 属性定义{{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和{{ SVGAttr("height") }}使用的坐标系系统。 + +如果 filterUnits 属性未指定,那么效果如同指定了值为`objectBoundingBox.` + +## Usage context + +| Categories | _None_ | +| ------------------ | -------------------------------------------------------------------------------------------------- | +| Value | `userSpaceOnUse` \| **`objectBoundingBox`** | +| Animatable | Yes | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#FilterElementFilterUnitsAttribute) | + +- userSpaceOnUse + - : {{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和 {{ SVGAttr("height") }} 表示当前坐标系统中的值,这些值表示{{ SVGElement("filter") }}元素在当前用户坐标系中的位置和大小 (例如通过{{ SVGAttr("filter") }}引用该{{ SVGElement("filter") }}元素的元素所在的坐标系系统). +- objectBoundingBox + - : 在这种情况下,{{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} 和 {{ SVGAttr("height") }}biao 表示引用{{ SVGElement("filter") }}元素的元素的 baow 包围盒的分数或百分比。 + +## Examples + +## Elements + +下面这些元素可以使用 filterUnits 属性: + +- {{ SVGElement("filter") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/font-family/index.html b/files/zh-cn/web/svg/attribute/font-family/index.html deleted file mode 100644 index 48827e024f7fcc..00000000000000 --- a/files/zh-cn/web/svg/attribute/font-family/index.html +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: font-family -slug: Web/SVG/Attribute/font-family -tags: - - SVG 属性 -translation_of: Web/SVG/Attribute/font-family ---- -

« SVG Attribute reference home

-

font-family 属性 (attribute) 指出哪个字体集将被用来渲染文字, 在带优先级的字体集名称列表被指定,还有或没有泛指的字符集名称。(specified as a prioritized list of font family names and/or generic family names)。

-

作为一个表现层的属性,font-family属性也可以被直接用在 CSS 样式表中,详见 {{ cssxref("font-family","CSS font-family") }} 。

-

使用上下文

- - - - - - - - - - - - - - - - - - - -
分类Presentation attribute
[[<family-name> | <generic-family>],]* [<family-name> | <generic-family>] | inherit
可动画 AnimatableYes
规范文档SVG 1.1 (2nd Edition)
-

例子

-

CSS

-
p.class1{font-family:"Times New Roman",Times,serif;}
-p.class2{font-family:Arial,Helvetica;}
-
-

HTML

-
<p class="class1">This is a paragraph, shown in the Times New Roman font.</p>
-<p class="class2">This is a paragraph, shown in the Arial font.</p>
-
-

元素

-

以下元素可以使用font-family 属性 (attribute)

- - -

规范

- -{{Specifications}} - -

另见

-
    -
  • {{ cssxref("font-family","CSS font-family") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/font-family/index.md b/files/zh-cn/web/svg/attribute/font-family/index.md new file mode 100644 index 00000000000000..f67d0bf4d829c4 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/font-family/index.md @@ -0,0 +1,50 @@ +--- +title: font-family +slug: Web/SVG/Attribute/font-family +tags: + - SVG 属性 +translation_of: Web/SVG/Attribute/font-family +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +`font-family` 属性 (attribute) 指出哪个字体集将被用来渲染文字, 在带优先级的字体集名称列表被指定,还有或没有泛指的字符集名称。(specified as a prioritized list of font family names and/or generic family names)。 + +作为一个表现层的属性,`font-family`属性也可以被直接用在 CSS 样式表中,详见 {{ cssxref("font-family","CSS font-family") }} 。 + +## 使用上下文 + +| 分类 | Presentation attribute | +| ----------------- | --------------------------------------------------------------------------------------- | +| 值 | [[ \| ],]\* [ \| ] \| inherit | +| 可动画 Animatable | Yes | +| 规范文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/text.html#FontFamilyProperty) | + +## 例子 + +#### CSS + +```plain +p.class1{font-family:"Times New Roman",Times,serif;} +p.class2{font-family:Arial,Helvetica;} +``` + +#### HTML + +```html +

This is a paragraph, shown in the Times New Roman font.

+

This is a paragraph, shown in the Arial font.

+``` + +## 元素 + +以下元素可以使用`font-family` 属性 (attribute) + +- [Text content elements](/en/SVG/Element#Text_content_elements) » + +## 规范 + +{{Specifications}} + +## 另见 + +- {{ cssxref("font-family","CSS font-family") }} diff --git a/files/zh-cn/web/svg/attribute/fr/index.html b/files/zh-cn/web/svg/attribute/fr/index.html deleted file mode 100644 index 059e763ae3cd90..00000000000000 --- a/files/zh-cn/web/svg/attribute/fr/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: fr -slug: Web/SVG/Attribute/fr -tags: - - SVG 属性 - - SVG 径向渐变 - - SVG 径向渐变焦点 -translation_of: Web/SVG/Attribute/fr ---- -

« SVG 属性参考主页

- -

对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的半径。若该属性没有被定义,默认值为 0%。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别
<length>
可变性
规范文档SVG 1.1 (2nd Edition): The radialGradient element
- -

示例

- -
<?xml version="1.0" standalone="no"?>
-
-<svg width="120" height="120" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <defs>
-      <radialGradient id="Gradient"
-            cx="0.5" cy="0.5" r="0.5" fx="0.35" fy="0.35" fr="5%">
-        <stop offset="0%" stop-color="red"/>
-        <stop offset="100%" stop-color="blue"/>
-      </radialGradient>
-  </defs>
-
-  <rect x="10" y="10" rx="15" ry="15" width="100" height="100"
-        fill="url(#Gradient)" stroke="black" stroke-width="2"/>
-
-  <circle cx="60" cy="60" r="50" fill="transparent" stroke="white" stroke-width="2"/>
-  <circle cx="35" cy="35" r="2" fill="white" stroke="white"/>
-  <circle cx="60" cy="60" r="2" fill="white" stroke="white"/>
-  <text x="38" y="40" fill="white" font-family="sans-serif" font-size="10pt">(fx,fy)</text>
-  <text x="63" y="63" fill="white" font-family="sans-serif" font-size="10pt">(cx,cy)</text>
-
-</svg>
- -

元素

- -

下列元素可以使用 fr 属性:

- -
    -
  • {{ SVGElement("radialGradient") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fr/index.md b/files/zh-cn/web/svg/attribute/fr/index.md new file mode 100644 index 00000000000000..b9b17c913ffab2 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fr/index.md @@ -0,0 +1,57 @@ +--- +title: fr +slug: Web/SVG/Attribute/fr +tags: + - SVG 属性 + - SVG 径向渐变 + - SVG 径向渐变焦点 +translation_of: Web/SVG/Attribute/fr +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的半径。若该属性没有被定义,默认值为 0%。 + +## 用法 + +| 类别 | 无 | +| -------- | ---------------------------------------------------------------------------------------------------------------------------- | +| 值 | [](/zh-CN/docs/Web/SVG/Content_type#Length) | +| 可变性 | 非 | +| 规范文档 | [SVG 1.1 (2nd Edition): The radialGradient element](http://www.w3.org/TR/SVG/pservers.html#RadialGradientElementCXAttribute) | + +## 示例 + +```html + + + + + + + + + + + + + + + + (fx,fy) + (cx,cy) + + +``` + +## 元素 + +下列元素可以使用 `fr` 属性: + +- {{ SVGElement("radialGradient") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/from/index.html b/files/zh-cn/web/svg/attribute/from/index.html deleted file mode 100644 index 4224f896db1f26..00000000000000 --- a/files/zh-cn/web/svg/attribute/from/index.html +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: from -slug: Web/SVG/Attribute/From -translation_of: Web/SVG/Attribute/From ---- -

« SVG 属性参考

- -

这个属性是在 svg 动画发生过程中被修改的属性的初始值。当同时使用了这个属性和 to 属性,animation 将会修改这个这个设定的动画属性的值从 from 属性的值到 to 属性的值。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别动画属性值
<value>
动画特征No
标准化文档SVG 1.1 (2nd Edition)
- -

这个属性的准确的值类型取决于这个属性将要被用作动画的属性的值。

- -

例子

- -

这个例子给 from 属性了一个 100 的值,让动画从 100 的宽度开始运行。

- -
<?xml version="1.0"?>
-<svg width="200" height="200"
-  viewPort="0 0 200 200" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-
-  <rect x="10" y="10" width="100" height="100">
-    <animate attributeType="XML"
-      attributeName="width"
-      from="100" to="150"
-      dur="3s"
-      fill="freeze"/>
-  </rect>
-
-</svg>
- -

元素

- -

如下的元素能使用 from 属性

- -
    -
  • {{ SVGElement("animate") }}
  • -
  • {{ SVGElement("animateColor") }}
  • -
  • {{ SVGElement("animateMotion") }}
  • -
  • {{ SVGElement("animateTransform") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/from/index.md b/files/zh-cn/web/svg/attribute/from/index.md new file mode 100644 index 00000000000000..200c78a96946a8 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/from/index.md @@ -0,0 +1,52 @@ +--- +title: from +slug: Web/SVG/Attribute/From +translation_of: Web/SVG/Attribute/From +--- +« [SVG 属性参考](/en/SVG/Attribute) + +这个属性是在 svg 动画发生过程中被修改的属性的初始值。当同时使用了这个属性和 [to](/zh-CN/docs/Web/SVG/Attribute/To) 属性,animation 将会修改这个这个设定的动画属性的值从 from 属性的值到 to 属性的值。 + +## 用法 + +| 类别 | 动画属性值 | +| ---------- | ---------------------------------------------------------------------------- | +| 值 | | +| 动画特征 | No | +| 标准化文档 | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG/animate.html#FromAttribute) | + +这个属性的准确的值类型取决于这个属性将要被用作动画的属性的值。 + +## 例子 + +这个例子给 from 属性了一个 100 的值,让动画从 100 的宽度开始运行。 + +```xml + + + + + + + + +``` + +## 元素 + +如下的元素能使用 from 属性 + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateMotion") }} +- {{ SVGElement("animateTransform") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fx/index.html b/files/zh-cn/web/svg/attribute/fx/index.html deleted file mode 100644 index e85ff0709443de..00000000000000 --- a/files/zh-cn/web/svg/attribute/fx/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: fx -slug: Web/SVG/Attribute/fx -tags: - - SVG - - SVG 属性 - - SVG 径向渐变 - - SVG 渐变 - - SVG 渐变焦点 -translation_of: Web/SVG/Attribute/fx ---- -

« SVG 属性参考主页

- -

对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的 x 轴坐标。如果该属性没有被定义,就假定它与中心点是同一位置。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别
<coordinate>
可变性
规范文档 SVG 1.1 (2nd Edition): The radialGradient element
- -

示例

- -
<?xml version="1.0" standalone="no"?>
-
-<svg width="120" height="120" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <defs>
-      <radialGradient id="Gradient"
-            cx="0.5" cy="0.5" r="0.5" fx="0.25" fy="0.25">
-        <stop offset="0%" stop-color="red"/>
-        <stop offset="100%" stop-color="blue"/>
-      </radialGradient>
-  </defs>
-
-  <rect x="10" y="10" rx="15" ry="15" width="100" height="100"
-        fill="url(#Gradient)" stroke="black" stroke-width="2"/>
-
-  <circle cx="60" cy="60" r="50" fill="transparent" stroke="white" stroke-width="2"/>
-  <circle cx="35" cy="35" r="2" fill="white" stroke="white"/>
-  <circle cx="60" cy="60" r="2" fill="white" stroke="white"/>
-  <text x="38" y="40" fill="white" font-family="sans-serif" font-size="10pt">(fx,fy)</text>
-  <text x="63" y="63" fill="white" font-family="sans-serif" font-size="10pt">(cx,cy)</text>
-
-</svg>
- -

元素

- -

下列元素可以使用 fx 属性:

- -
    -
  • {{ SVGElement("radialGradient") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fx/index.md b/files/zh-cn/web/svg/attribute/fx/index.md new file mode 100644 index 00000000000000..363ff523acc20d --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fx/index.md @@ -0,0 +1,59 @@ +--- +title: fx +slug: Web/SVG/Attribute/fx +tags: + - SVG + - SVG 属性 + - SVG 径向渐变 + - SVG 渐变 + - SVG 渐变焦点 +translation_of: Web/SVG/Attribute/fx +--- +« [SVG 属性参考主页](/zh-CN/docs/web/SVG/Attribute) + +对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的 x 轴坐标。如果该属性没有被定义,就假定它与中心点是同一位置。 + +## 用法 + +| 类别 | 无 | +| -------- | ---------------------------------------------------------------------------------------------------------------------------- | +| 值 | [](https://developer.mozilla.org/en/SVG/Content_type#Coordinate) | +| 可变性 | 非 | +| 规范文档 | [SVG 1.1 (2nd Edition): The radialGradient element](http://www.w3.org/TR/SVG/pservers.html#RadialGradientElementCXAttribute) | + +## 示例 + +```html + + + + + + + + + + + + + + + + (fx,fy) + (cx,cy) + + +``` + +## 元素 + +下列元素可以使用 `fx` 属性: + +- {{ SVGElement("radialGradient") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fy/index.html b/files/zh-cn/web/svg/attribute/fy/index.html deleted file mode 100644 index 2f6c9b9000064b..00000000000000 --- a/files/zh-cn/web/svg/attribute/fy/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: fy -slug: Web/SVG/Attribute/fy -tags: - - SVG 属性 - - SVG 径向渐变 - - SVG 径向渐变焦点 - - SVG 渐变属性 -translation_of: Web/SVG/Attribute/fy ---- -

« SVG 属性参考主页

- -

对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的 y 轴坐标。如果该属性没有被定义,就假定它与中心点是同一位置。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别
<coordinate>
可变性
规范文档SVG 1.1 (2nd Edition): The radialGradient element
- -

{{ page("/en/SVG/Content_type","Coordinate") }}

- -

示例

- -
<?xml version="1.0" standalone="no"?>
-
-<svg width="120" height="120" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <defs>
-      <radialGradient id="Gradient"
-            cx="0.5" cy="0.5" r="0.5" fx="0.25" fy="0.25">
-        <stop offset="0%" stop-color="red"/>
-        <stop offset="100%" stop-color="blue"/>
-      </radialGradient>
-  </defs>
-
-  <rect x="10" y="10" rx="15" ry="15" width="100" height="100"
-        fill="url(#Gradient)" stroke="black" stroke-width="2"/>
-
-  <circle cx="60" cy="60" r="50" fill="transparent" stroke="white" stroke-width="2"/>
-  <circle cx="35" cy="35" r="2" fill="white" stroke="white"/>
-  <circle cx="60" cy="60" r="2" fill="white" stroke="white"/>
-  <text x="38" y="40" fill="white" font-family="sans-serif" font-size="10pt">(fx,fy)</text>
-  <text x="63" y="63" fill="white" font-family="sans-serif" font-size="10pt">(cx,cy)</text>
-
-</svg>
- -

元素

- -

下列元素可以使用 fy 属性:

- -
    -
  • {{ SVGElement("radialGradient") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/fy/index.md b/files/zh-cn/web/svg/attribute/fy/index.md new file mode 100644 index 00000000000000..6669eef23bc2f3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/fy/index.md @@ -0,0 +1,60 @@ +--- +title: fy +slug: Web/SVG/Attribute/fy +tags: + - SVG 属性 + - SVG 径向渐变 + - SVG 径向渐变焦点 + - SVG 渐变属性 +translation_of: Web/SVG/Attribute/fy +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +对于 {{ SVGElement("radialGradient") }} 元素,此属性用来定义径向渐变的焦点的 y 轴坐标。如果该属性没有被定义,就假定它与中心点是同一位置。 + +## 用法 + +| 类别 | 无 | +| -------- | ---------------------------------------------------------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Coordinate) | +| 可变性 | 非 | +| 规范文档 | [SVG 1.1 (2nd Edition): The radialGradient element](http://www.w3.org/TR/SVG/pservers.html#RadialGradientElementCXAttribute) | + +{{ page("/en/SVG/Content_type","Coordinate") }} + +## 示例 + +```html + + + + + + + + + + + + + + + + (fx,fy) + (cx,cy) + + +``` + +## 元素 + +下列元素可以使用 `fy` 属性: + +- {{ SVGElement("radialGradient") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/height/index.html b/files/zh-cn/web/svg/attribute/height/index.html deleted file mode 100644 index ac462c53ed4f3f..00000000000000 --- a/files/zh-cn/web/svg/attribute/height/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: height -slug: Web/SVG/Attribute/height -tags: - - NeedsCompatTable - - SVG - - SVG Attribute -translation_of: Web/SVG/Attribute/height ---- -

« SVG 属性参考主页

- -

该属性在用户坐标系统中标识了一个垂直长度。该坐标的确切效果依赖于每个元素。大多数时候,它体现引用元素的矩形区域的高度(请阅读每个元素的文档以了解例外情况)。

- -

除了{{ SVGElement("svg") }}元素之外,别的元素都必须指定该属性,{{ SVGElement("svg") }}的高度默认是100%,而{{ SVGElement("filter") }}元素以及{{ SVGElement("mask") }}元素的默认高度是120%

- -

用法

- - - - - - - - - - - - - - - - -
类别
<length>
可变性Yes
- -

{{ page("/zh-CN/Content_type","Length") }}

- -

示例

- -
<?xml version="1.0"?>
-<svg width="120" height="120"
-     viewBox="0 0 120 120"
-     xmlns="http://www.w3.org/2000/svg">
-
-  <rect x="10" y="10" width="100" height="100"/>
-</svg>
- -

元素

- -

下列元素可以使用 height 属性:

- -
    -
  • 滤镜元素 »
  • -
  • {{ SVGElement("filter") }}
  • -
  • {{ SVGElement("foreignObject") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("rect") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("use") }}
  • -
  • {{ SVGElement("mask") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/height/index.md b/files/zh-cn/web/svg/attribute/height/index.md new file mode 100644 index 00000000000000..a03ceb1170321e --- /dev/null +++ b/files/zh-cn/web/svg/attribute/height/index.md @@ -0,0 +1,53 @@ +--- +title: height +slug: Web/SVG/Attribute/height +tags: + - NeedsCompatTable + - SVG + - SVG Attribute +translation_of: Web/SVG/Attribute/height +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性在用户坐标系统中标识了一个垂直长度。该坐标的确切效果依赖于每个元素。大多数时候,它体现引用元素的矩形区域的高度(请阅读每个元素的文档以了解例外情况)。 + +除了{{ SVGElement("svg") }}元素之外,别的元素都必须指定该属性,{{ SVGElement("svg") }}的高度默认是**100%**,而{{ SVGElement("filter") }}元素以及{{ SVGElement("mask") }}元素的默认高度是**120%**。 + +## 用法 + +| 类别 | 无 | +| ------ | --------------------------------------- | +| 值 | [](/en/SVG/Content_type#Length) | +| 可变性 | Yes | + +{{ page("/zh-CN/Content_type","Length") }} + +## 示例 + +```html + + + + + +``` + +## 元素 + +下列元素可以使用 `height `属性: + +- [滤镜元素](/en/SVG/Element#FilterPrimitive) » +- {{ SVGElement("filter") }} +- {{ SVGElement("foreignObject") }} +- {{ SVGElement("image") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("rect") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("use") }} +- {{ SVGElement("mask") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/id/index.html b/files/zh-cn/web/svg/attribute/id/index.html deleted file mode 100644 index a1b8ff6496af3d..00000000000000 --- a/files/zh-cn/web/svg/attribute/id/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: id -slug: Web/SVG/Attribute/id -translation_of: Web/SVG/Attribute/id ---- -
{{SVGRef}}
- -

id 属性给予元素一个唯一名称。

- -

所有元素均可使用该属性。

- -
-
<svg width="120" height="120" viewPort="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
-  <style type="text/css">
-    <![CDATA[
-      #smallRect {
-        stroke: #000066;
-        fill: #00cc00;
-      }
-    ]]>
-  </style>
-
-  <rect id="smallRect" x="10" y="10" width="100" height="100" />
-</svg>
-
- -

{{EmbedLiveSample("topExample", "120", "120")}}

-
- -

用法说明

- - - - - - - - - - - - - - - - -
<id>
默认值None
可动画No
- -
-
<id>
-
-

指定元素的 ID。 该 ID 在节点树中必须是唯一的,不能为空字符串,并且不能包含任何空格字符。

- -
-

注意: 应当避免使用会被解析为 SVG 视图规范的 id 值(如MyDrawing.svg#svgView(viewBox(0,200,1000,1000))),或被解析为用作 URL 目标片段的基本媒体片段的 id 值。

-
- - - -

该属性取值必须在 XML 文档中有效。 独立的 SVG 文档使用 XML 1.0 语法,该语法指定有效的 ID 仅包含指定的字符(字母,数字和一些标点符号),开头不能是数字,点(.)字符或 连字符减号(-)。

-
-
- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

- -

参考

- -
    -
  • HTML id
  • -
  • {{SVGAttr("class")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/id/index.md b/files/zh-cn/web/svg/attribute/id/index.md new file mode 100644 index 00000000000000..647d79cb1ac1ab --- /dev/null +++ b/files/zh-cn/web/svg/attribute/id/index.md @@ -0,0 +1,56 @@ +--- +title: id +slug: Web/SVG/Attribute/id +translation_of: Web/SVG/Attribute/id +--- +{{SVGRef}} + +**`id`** 属性给予元素一个唯一名称。 + +所有元素均可使用该属性。 + +## 示例 + +```html + + + + + +``` + +{{EmbedLiveSample("示例", "120", "120")}} + +## 用法说明 + +| 值 | | +| ------ | ------ | +| 默认值 | _None_ | +| 可动画 | No | + +- \ + - : 指定元素的 ID。 该 ID 在节点树中必须是唯一的,不能为空字符串,并且不能包含任何空格字符。 + + > **备注:** 应当避免使用会被解析为 SVG 视图规范的 `id` 值(如 `MyDrawing.svg#svgView(viewBox(0,200,1000,1000))`),或被解析为用作 URL 目标片段的基本媒体片段的 `id` 值。 + + 该属性取值必须在 XML 文档中有效。 独立的 SVG 文档使用 XML 1.0 语法,该语法指定有效的 ID 仅包含指定的字符(字母,数字和一些标点符号),开头不能是数字,点(.)字符或 连字符减号(-)。 + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} + +## 参考 + +- [HTML `id`](/zh-CN/docs/Web/HTML/Global_attributes/id) +- {{SVGAttr("class")}} diff --git a/files/zh-cn/web/svg/attribute/image-rendering/index.html b/files/zh-cn/web/svg/attribute/image-rendering/index.html deleted file mode 100644 index eb85f2bec01584..00000000000000 --- a/files/zh-cn/web/svg/attribute/image-rendering/index.html +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: image-rendering -slug: Web/SVG/Attribute/image-rendering -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/image-rendering ---- -

« SVG Attribute reference home

-

image-rendering 属性向浏览器提供了一个提示,即在图片处理时,如何进行速度 vs 质量之间的权衡。
-
- 作为一个显示属性,它也可以在 CSS 样式文件中作为属性而存在,请参考 {{ cssxref("image-rendering","CSS image-rendering") }} 获取更多的信息

-

使用语境

- - - - - - - - - - - - - - - -
类别Presentation attribute
auto | optimizeSpeed | optimizeQuality | inherit
动画效果Yes
-
-
- auto
-
- 表示用户代理可以在速度和质量间做适当的权衡,但是质量将比速度更重要一些。
-
- optimizeSpeed
-
- 表示用户代理应该更注重速度。
-
- optimizeQuality
-
- 表示用户代理应该更注重质量
-
-

示例

-

元素

-

下面的元素可以能够使用 image-rendering 属性

-
    -
  • {{ SVGElement("image") }}
  • -
- -

规范

- -{{Specifications}} - -

参考

-
    -
  • {{ cssxref("image-rendering","CSS image-rendering") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/image-rendering/index.md b/files/zh-cn/web/svg/attribute/image-rendering/index.md new file mode 100644 index 00000000000000..06cb8cf6f2c841 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/image-rendering/index.md @@ -0,0 +1,43 @@ +--- +title: image-rendering +slug: Web/SVG/Attribute/image-rendering +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/image-rendering +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +`image-rendering` 属性向浏览器提供了一个提示,即在图片处理时,如何进行速度 vs 质量之间的权衡。 + +作为一个显示属性,它也可以在 CSS 样式文件中作为属性而存在,请参考 {{ cssxref("image-rendering","CSS image-rendering") }} 获取更多的信息 + +## 使用语境 + +| 类别 | Presentation attribute | +| -------- | ------------------------------------------------------- | +| 值 | **auto** \| optimizeSpeed \| optimizeQuality \| inherit | +| 动画效果 | Yes | + +- auto + - : 表示用户代理可以在速度和质量间做适当的权衡,但是质量将比速度更重要一些。 +- optimizeSpeed + - : 表示用户代理应该更注重速度。 +- optimizeQuality + - : 表示用户代理应该更注重质量 + +## 示例 + +## 元素 + +下面的元素可以能够使用 `image-rendering` 属性 + +- {{ SVGElement("image") }} + +## 规范 + +{{Specifications}} + +## 参考 + +- {{ cssxref("image-rendering","CSS image-rendering") }} diff --git a/files/zh-cn/web/svg/attribute/in/index.html b/files/zh-cn/web/svg/attribute/in/index.html deleted file mode 100644 index 6bb56bd2c67a51..00000000000000 --- a/files/zh-cn/web/svg/attribute/in/index.html +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: in -slug: Web/SVG/Attribute/in -translation_of: Web/SVG/Attribute/in ---- -

« SVG Attribute reference home

- -

in 属性标识输入的原语。

- -

其值可以是下面六种关键词中的一种,或者是一个字符串匹配在同一个{{SVGElement("filter")}}元素中前面的原语的{{SVGAttr("result")}} 属性值。如果没有提供值并且这是 filter 中第一个原语,那么原语将相当于使用 SourceGraphic 作为输入值。如果没有提供值并且这不是第一个原语,那么原语将使用前面原语的 result 属性值作为输入。
-
- 如果{{SVGAttr("result")}}的值在同一个{{SVGElement("filter")}}中出现多次,那么将使用前面的距离使用该{{SVGAttr("result")}}值的原语最近的该 result 值的原语作为输入。

- -

除了 SourceGraphic 和<filter-primitive-reference> (引用原语) , 关键词都没有在现代浏览器中实现.(译者注:SourceAlpha 也被现代浏览器支持)

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesNone
ValueSourceGraphic | SourceAlpha | BackgroundImage | BackgroundAlpha | FillPaint | StrokePaint | <filter-primitive-reference>
AnimatableYes
- -
-
SourceGraphic
-
该关键词表示图形元素自身将作为{{SVGElement("filter")}}原语的原始输入。
-
SourceAlpha
-
该关键词表示图形元素自身将作为{{SVGElement("filter")}}原语的原始输入. SourceAlpha 与 SourceGraphic 具有相同的规则除了 SourceAlpha 只使用元素的透明度。
-
BackgroundImage
-
该关键词表示 filter 元素当前底下的区域的图形快照将被调用。
-
BackgroundAlpha
-
跟 BackgroundImage 相同除了只使用透明度。
-
FillPaint
-
This keyword represents the value of the {{SVGAttr("fill")}} property on the target element for the filter effect. In many cases, the FillPaint is opaque everywhere, but it might not be the case if a shape is paint with a gradient or pattern which itself includes transparent or semi-transparent parts.
-
StrokePaint
-
This keyword represents the value of the {{SVGAttr("stroke")}} property on the target element for the filter effect. In many cases, the StrokePaint is opaque everywhere, but it might not be the case if a shape is paint with a gradient or pattern which itself includes transparent or semi-transparent parts.
-
- -

BackgroundImage 的解决方案

- -

我们需要使用 < feimage >原语引入一个图像混合到过滤器本身内来替代使用"BackgroundImage".

- -

HTML Content

- -
<div style="width: 420px; height: 220px;">
-<svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-  <defs>
-    <filter id="backgroundMultiply">
-      <!-- This will not work. -->
-      <feBlend in="BackgroundImage" in2="SourceGraphic" mode="multiply"/>
-    </filter>
-  </defs>
-  <image xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/>
-  <circle cx="50%" cy="40%" r="40%" fill="#c00" style="filter:url(#backgroundMultiply);" />
-</svg>
-
-<svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-  <defs>
-    <filter id="imageMultiply">
-      <!-- This is a workaround. -->
-      <feImage xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/>
-      <feBlend in2="SourceGraphic" mode="multiply"/>
-    </filter>
-  </defs>
-  <circle cx="50%" cy="40%" r="40%" fill="#c00" style="filter:url(#imageMultiply);"/>
-</svg>
-</div>
- -

效果

- -

{{ EmbedLiveSample('Workaround_for_backgroundImage') }}

- -

元素

- -

下列元素可以使用该属性

- -
    -
  • {{SVGElement("feBlend")}}
  • -
  • {{SVGElement("feColorMatrix")}}
  • -
  • {{SVGElement("feComponentTransfer")}}
  • -
  • {{SVGElement("feComposite")}}
  • -
  • {{SVGElement("feConvolveMatrix")}}
  • -
  • {{SVGElement("feDiffuseLighting")}}
  • -
  • {{SVGElement("feDisplacementMap")}}
  • -
  • {{SVGElement("feGaussianBlur")}}
  • -
  • {{SVGElement("feMorphology")}}
  • -
  • {{SVGElement("feOffset")}}
  • -
  • {{SVGElement("feSpecularLighting")}}
  • -
  • {{SVGElement("feTile")}}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/in/index.md b/files/zh-cn/web/svg/attribute/in/index.md new file mode 100644 index 00000000000000..f8dfefda985752 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/in/index.md @@ -0,0 +1,91 @@ +--- +title: in +slug: Web/SVG/Attribute/in +translation_of: Web/SVG/Attribute/in +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +in 属性标识输入的原语。 + +其值可以是下面六种关键词中的一种,或者是一个字符串匹配在同一个{{SVGElement("filter")}}元素中前面的原语的{{SVGAttr("result")}} 属性值。如果没有提供值并且这是 filter 中第一个原语,那么原语将相当于使用 SourceGraphic 作为输入值。如果没有提供值并且这不是第一个原语,那么原语将使用前面原语的 result 属性值作为输入。 + +如果{{SVGAttr("result")}}的值在同一个{{SVGElement("filter")}}中出现多次,那么将使用前面的距离使用该{{SVGAttr("result")}}值的原语最近的该 result 值的原语作为输入。 + +除了 SourceGraphic 和**\ (引用原语)** , 关键词都没有在现代浏览器中实现.(译者注:SourceAlpha 也被现代浏览器支持) + +## Usage context + +| Categories | None | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ | +| Value | `SourceGraphic` \| `SourceAlpha` \| `BackgroundImage` \| `BackgroundAlpha` \| `FillPaint` \| `StrokePaint` \| | +| Animatable | Yes | + +- SourceGraphic + - : 该关键词表示图形元素自身将作为{{SVGElement("filter")}}原语的原始输入。 +- SourceAlpha + - : 该关键词表示图形元素自身将作为{{SVGElement("filter")}}原语的原始输入. SourceAlpha 与 SourceGraphic 具有相同的规则除了 SourceAlpha 只使用元素的透明度。 +- BackgroundImage + - : 该关键词表示 filter 元素当前底下的区域的图形快照将被调用。 +- BackgroundAlpha + - : 跟 BackgroundImage 相同除了只使用透明度。 +- FillPaint + - : This keyword represents the value of the {{SVGAttr("fill")}} property on the target element for the filter effect. In many cases, the `FillPaint` is opaque everywhere, but it might not be the case if a shape is paint with a gradient or pattern which itself includes transparent or semi-transparent parts. +- StrokePaint + - : This keyword represents the value of the {{SVGAttr("stroke")}} property on the target element for the filter effect. In many cases, the `StrokePaint` is opaque everywhere, but it might not be the case if a shape is paint with a gradient or pattern which itself includes transparent or semi-transparent parts. + +## BackgroundImage 的解决方案 + +我们需要使用 < feimage >原语引入一个图像混合到过滤器本身内来替代使用"BackgroundImage". + +### HTML Content + +```html +
+ + + + + + + + + + + + + + + + + + + + + +
+``` + +### 效果 + +{{ EmbedLiveSample('Workaround_for_backgroundImage') }} + +## 元素 + +下列元素可以使用该属性 + +- {{SVGElement("feBlend")}} +- {{SVGElement("feColorMatrix")}} +- {{SVGElement("feComponentTransfer")}} +- {{SVGElement("feComposite")}} +- {{SVGElement("feConvolveMatrix")}} +- {{SVGElement("feDiffuseLighting")}} +- {{SVGElement("feDisplacementMap")}} +- {{SVGElement("feGaussianBlur")}} +- {{SVGElement("feMorphology")}} +- {{SVGElement("feOffset")}} +- {{SVGElement("feSpecularLighting")}} +- {{SVGElement("feTile")}} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/index.html b/files/zh-cn/web/svg/attribute/index.html deleted file mode 100644 index 35931d1be4cbe1..00000000000000 --- a/files/zh-cn/web/svg/attribute/index.html +++ /dev/null @@ -1,476 +0,0 @@ ---- -title: SVG 属性参考 -slug: Web/SVG/Attribute -tags: - - SVG - - SVG Attribute - - SVG Reference - - SVG 属性 - - 矢量图形 -translation_of: Web/SVG/Attribute ---- -
{{SVGRef}}
- -

SVG 元素可以通过属性来修改,这些属性指定有关如何处理或呈现元素的详细信息。 下面列出了 SVG 中所有的可用属性以及参考文档的链接,以帮助您了解哪些元素支持它们,以及它们如何工作。

- -

SVG 属性(从 A-Z 排序)

- -
-

A

- -
    -
  • {{SVGAttr("accent-height")}}
  • -
  • {{SVGAttr("accumulate")}}
  • -
  • {{SVGAttr("additive")}}
  • -
  • {{SVGAttr("alignment-baseline")}}
  • -
  • {{SVGAttr("allowReorder")}}
  • -
  • {{SVGAttr("alphabetic")}}
  • -
  • {{SVGAttr("amplitude")}}
  • -
  • {{SVGAttr("arabic-form")}}
  • -
  • {{SVGAttr("ascent")}}
  • -
  • {{SVGAttr("attributeName")}}
  • -
  • {{SVGAttr("attributeType")}}
  • -
  • {{SVGAttr("autoReverse")}}
  • -
  • {{SVGAttr("azimuth")}}
  • -
- -

B

- -
    -
  • {{SVGAttr("baseFrequency")}}
  • -
  • {{SVGAttr("baseline-shift")}}
  • -
  • {{SVGAttr("baseProfile")}}
  • -
  • {{SVGAttr("bbox")}}
  • -
  • {{SVGAttr("begin")}}
  • -
  • {{SVGAttr("bias")}}
  • -
  • {{SVGAttr("by")}}
  • -
- -

C

- -
    -
  • {{SVGAttr("calcMode")}}
  • -
  • {{SVGAttr("cap-height")}}
  • -
  • {{SVGAttr("class")}}
  • -
  • {{SVGAttr("clip")}}
  • -
  • {{SVGAttr("clipPathUnits")}}
  • -
  • {{SVGAttr("clip-path")}}
  • -
  • {{SVGAttr("clip-rule")}}
  • -
  • {{SVGAttr("color")}}
  • -
  • {{SVGAttr("color-interpolation")}}
  • -
  • {{SVGAttr("color-interpolation-filters")}}
  • -
  • {{SVGAttr("color-profile")}}
  • -
  • {{SVGAttr("color-rendering")}}
  • -
  • {{SVGAttr("contentScriptType")}}
  • -
  • {{SVGAttr("contentStyleType")}}
  • -
  • {{SVGAttr("cursor")}}
  • -
  • {{SVGAttr("cx")}}
  • -
  • {{SVGAttr("cy")}}
  • -
- -

D

- -
    -
  • {{SVGAttr("d")}}
  • -
  • {{SVGAttr("decelerate")}}
  • -
  • {{SVGAttr("descent")}}
  • -
  • {{SVGAttr("diffuseConstant")}}
  • -
  • {{SVGAttr("direction")}}
  • -
  • {{SVGAttr("display")}}
  • -
  • {{SVGAttr("divisor")}}
  • -
  • {{SVGAttr("dominant-baseline")}}
  • -
  • {{SVGAttr("dur")}}
  • -
  • {{SVGAttr("dx")}}
  • -
  • {{SVGAttr("dy")}}
  • -
- -

E

- -
    -
  • {{SVGAttr("edgeMode")}}
  • -
  • {{SVGAttr("elevation")}}
  • -
  • {{SVGAttr("enable-background")}}
  • -
  • {{SVGAttr("end")}}
  • -
  • {{SVGAttr("exponent")}}
  • -
  • {{SVGAttr("externalResourcesRequired")}}
  • -
- -

F

- -
    -
  • {{SVGAttr("fill")}}
  • -
  • {{SVGAttr("fill-opacity")}}
  • -
  • {{SVGAttr("fill-rule")}}
  • -
  • {{SVGAttr("filter")}}
  • -
  • {{SVGAttr("filterRes")}}
  • -
  • {{SVGAttr("filterUnits")}}
  • -
  • {{SVGAttr("flood-color")}}
  • -
  • {{SVGAttr("flood-opacity")}}
  • -
  • {{SVGAttr("font-family")}}
  • -
  • {{SVGAttr("font-size")}}
  • -
  • {{SVGAttr("font-size-adjust")}}
  • -
  • {{SVGAttr("font-stretch")}}
  • -
  • {{SVGAttr("font-style")}}
  • -
  • {{SVGAttr("font-variant")}}
  • -
  • {{SVGAttr("font-weight")}}
  • -
  • {{SVGAttr("format")}}
  • -
  • {{SVGAttr("from")}}
  • -
  • {{SVGAttr("fr")}}
  • -
  • {{SVGAttr("fx")}}
  • -
  • {{SVGAttr("fy")}}
  • -
- -

G

- -
    -
  • {{SVGAttr("g1")}}
  • -
  • {{SVGAttr("g2")}}
  • -
  • {{SVGAttr("glyph-name")}}
  • -
  • {{SVGAttr("glyph-orientation-horizontal")}}
  • -
  • {{SVGAttr("glyph-orientation-vertical")}}
  • -
  • {{SVGAttr("glyphRef")}}
  • -
  • {{SVGAttr("gradientTransform")}}
  • -
  • {{SVGAttr("gradientUnits")}}
  • -
- -

H

- -
    -
  • {{SVGAttr("hanging")}}
  • -
  • {{SVGAttr("height")}}
  • -
  • {{SVGAttr("href")}}
  • -
  • {{SVGAttr("hreflang")}}
  • -
  • {{SVGAttr("horiz-adv-x")}}
  • -
  • {{SVGAttr("horiz-origin-x")}}
  • -
- -

I

- -
    -
  • {{SVGAttr("id")}}
  • -
  • {{SVGAttr("ideographic")}}
  • -
  • {{SVGAttr("image-rendering")}}
  • -
  • {{SVGAttr("in")}}
  • -
  • {{SVGAttr("in2")}}
  • -
  • {{SVGAttr("intercept")}}
  • -
- -

K

- -
    -
  • {{SVGAttr("k")}}
  • -
  • {{SVGAttr("k1")}}
  • -
  • {{SVGAttr("k2")}}
  • -
  • {{SVGAttr("k3")}}
  • -
  • {{SVGAttr("k4")}}
  • -
  • {{SVGAttr("kernelMatrix")}}
  • -
  • {{SVGAttr("kernelUnitLength")}}
  • -
  • {{SVGAttr("kerning")}}
  • -
  • {{SVGAttr("keyPoints")}}
  • -
  • {{SVGAttr("keySplines")}}
  • -
  • {{SVGAttr("keyTimes")}}
  • -
- -

L

- -
    -
  • {{SVGAttr("lang")}}
  • -
  • {{SVGAttr("lengthAdjust")}}
  • -
  • {{SVGAttr("letter-spacing")}}
  • -
  • {{SVGAttr("lighting-color")}}
  • -
  • {{SVGAttr("limitingConeAngle")}}
  • -
  • {{SVGAttr("local")}}
  • -
- -

M

- -
    -
  • {{SVGAttr("marker-end")}}
  • -
  • {{SVGAttr("marker-mid")}}
  • -
  • {{SVGAttr("marker-start")}}
  • -
  • {{SVGAttr("markerHeight")}}
  • -
  • {{SVGAttr("markerUnits")}}
  • -
  • {{SVGAttr("markerWidth")}}
  • -
  • {{SVGAttr("mask")}}
  • -
  • {{SVGAttr("maskContentUnits")}}
  • -
  • {{SVGAttr("maskUnits")}}
  • -
  • {{SVGAttr("mathematical")}}
  • -
  • {{SVGAttr("max")}}
  • -
  • {{SVGAttr("media")}}
  • -
  • {{SVGAttr("method")}}
  • -
  • {{SVGAttr("min")}}
  • -
  • {{SVGAttr("mode")}}
  • -
- -

N

- -
    -
  • {{SVGAttr("name")}}
  • -
  • {{SVGAttr("numOctaves")}}
  • -
- -

O

- -
    -
  • {{SVGAttr("offset")}}
  • -
  • {{SVGAttr("opacity")}}
  • -
  • {{SVGAttr("operator")}}
  • -
  • {{SVGAttr("order")}}
  • -
  • {{SVGAttr("orient")}}
  • -
  • {{SVGAttr("orientation")}}
  • -
  • {{SVGAttr("origin")}}
  • -
  • {{SVGAttr("overflow")}}
  • -
  • {{SVGAttr("overline-position")}}
  • -
  • {{SVGAttr("overline-thickness")}}
  • -
- -

P

- -
    -
  • {{SVGAttr("panose-1")}}
  • -
  • {{SVGAttr("paint-order")}}
  • -
  • {{SVGAttr("path")}}
  • -
  • {{SVGAttr("pathLength")}}
  • -
  • {{SVGAttr("patternContentUnits")}}
  • -
  • {{SVGAttr("patternTransform")}}
  • -
  • {{SVGAttr("patternUnits")}}
  • -
  • {{SVGAttr("ping")}}
  • -
  • {{SVGAttr("pointer-events")}}
  • -
  • {{SVGAttr("points")}}
  • -
  • {{SVGAttr("pointsAtX")}}
  • -
  • {{SVGAttr("pointsAtY")}}
  • -
  • {{SVGAttr("pointsAtZ")}}
  • -
  • {{SVGAttr("preserveAlpha")}}
  • -
  • {{SVGAttr("preserveAspectRatio")}}
  • -
  • {{SVGAttr("primitiveUnits")}}
  • -
- -

R

- -
    -
  • {{SVGAttr("r")}}
  • -
  • {{SVGAttr("radius")}}
  • -
  • {{SVGAttr("referrerPolicy")}}
  • -
  • {{SVGAttr("refX")}}
  • -
  • {{SVGAttr("refY")}}
  • -
  • {{SVGAttr("rel")}}
  • -
  • {{SVGAttr("rendering-intent")}}
  • -
  • {{SVGAttr("repeatCount")}}
  • -
  • {{SVGAttr("repeatDur")}}
  • -
  • {{SVGAttr("requiredExtensions")}}
  • -
  • {{SVGAttr("requiredFeatures")}}
  • -
  • {{SVGAttr("restart")}}
  • -
  • {{SVGAttr("result")}}
  • -
  • {{SVGAttr("rotate")}}
  • -
  • {{SVGAttr("rx")}}
  • -
  • {{SVGAttr("ry")}}
  • -
- -

S

- -
    -
  • {{SVGAttr("scale")}}
  • -
  • {{SVGAttr("seed")}}
  • -
  • {{SVGAttr("shape-rendering")}}
  • -
  • {{SVGAttr("slope")}}
  • -
  • {{SVGAttr("spacing")}}
  • -
  • {{SVGAttr("specularConstant")}}
  • -
  • {{SVGAttr("specularExponent")}}
  • -
  • {{SVGAttr("speed")}}
  • -
  • {{SVGAttr("spreadMethod")}}
  • -
  • {{SVGAttr("startOffset")}}
  • -
  • {{SVGAttr("stdDeviation")}}
  • -
  • {{SVGAttr("stemh")}}
  • -
  • {{SVGAttr("stemv")}}
  • -
  • {{SVGAttr("stitchTiles")}}
  • -
  • {{SVGAttr("stop-color")}}
  • -
  • {{SVGAttr("stop-opacity")}}
  • -
  • {{SVGAttr("strikethrough-position")}}
  • -
  • {{SVGAttr("strikethrough-thickness")}}
  • -
  • {{SVGAttr("string")}}
  • -
  • {{SVGAttr("stroke")}}
  • -
  • {{SVGAttr("stroke-dasharray")}}
  • -
  • {{SVGAttr("stroke-dashoffset")}}
  • -
  • {{SVGAttr("stroke-linecap")}}
  • -
  • {{SVGAttr("stroke-linejoin")}}
  • -
  • {{SVGAttr("stroke-miterlimit")}}
  • -
  • {{SVGAttr("stroke-opacity")}}
  • -
  • {{SVGAttr("stroke-width")}}
  • -
  • {{SVGAttr("style")}}
  • -
  • {{SVGAttr("surfaceScale")}}
  • -
  • {{SVGAttr("systemLanguage")}}
  • -
- -

T

- -
    -
  • {{SVGAttr("tabindex")}}
  • -
  • {{SVGAttr("tableValues")}}
  • -
  • {{SVGAttr("target")}}
  • -
  • {{SVGAttr("targetX")}}
  • -
  • {{SVGAttr("targetY")}}
  • -
  • {{SVGAttr("text-anchor")}}
  • -
  • {{SVGAttr("text-decoration")}}
  • -
  • {{SVGAttr("text-rendering")}}
  • -
  • {{SVGAttr("textLength")}}
  • -
  • {{SVGAttr("to")}}
  • -
  • {{SVGAttr("transform")}}
  • -
  • {{SVGAttr("type")}}
  • -
- -

U

- -
    -
  • {{SVGAttr("u1")}}
  • -
  • {{SVGAttr("u2")}}
  • -
  • {{SVGAttr("underline-position")}}
  • -
  • {{SVGAttr("underline-thickness")}}
  • -
  • {{SVGAttr("unicode")}}
  • -
  • {{SVGAttr("unicode-bidi")}}
  • -
  • {{SVGAttr("unicode-range")}}
  • -
  • {{SVGAttr("units-per-em")}}
  • -
- -

V

- -
    -
  • {{SVGAttr("v-alphabetic")}}
  • -
  • {{SVGAttr("v-hanging")}}
  • -
  • {{SVGAttr("v-ideographic")}}
  • -
  • {{SVGAttr("v-mathematical")}}
  • -
  • {{SVGAttr("values")}}
  • -
  • {{SVGAttr("vector-effect")}}
  • -
  • {{SVGAttr("version")}}
  • -
  • {{SVGAttr("vert-adv-y")}}
  • -
  • {{SVGAttr("vert-origin-x")}}
  • -
  • {{SVGAttr("vert-origin-y")}}
  • -
  • {{SVGAttr("viewBox")}}
  • -
  • {{SVGAttr("viewTarget")}}
  • -
  • {{SVGAttr("visibility")}}
  • -
- -

W

- -
    -
  • {{SVGAttr("width")}}
  • -
  • {{SVGAttr("widths")}}
  • -
  • {{SVGAttr("word-spacing")}}
  • -
  • {{SVGAttr("writing-mode")}}
  • -
- -

X

- -
    -
  • {{SVGAttr("x")}}
  • -
  • {{SVGAttr("x-height")}}
  • -
  • {{SVGAttr("x1")}}
  • -
  • {{SVGAttr("x2")}}
  • -
  • {{SVGAttr("xChannelSelector")}}
  • -
  • {{SVGAttr("xlink:actuate")}}
  • -
  • {{SVGAttr("xlink:arcrole")}}
  • -
  • {{SVGAttr("xlink:href")}}
  • -
  • {{SVGAttr("xlink:role")}}
  • -
  • {{SVGAttr("xlink:show")}}
  • -
  • {{SVGAttr("xlink:title")}}
  • -
  • {{SVGAttr("xlink:type")}}
  • -
  • {{SVGAttr("xml:base")}}
  • -
  • {{SVGAttr("xml:lang")}}
  • -
  • {{SVGAttr("xml:space")}}
  • -
- -

Y

- -
    -
  • {{SVGAttr("y")}}
  • -
  • {{SVGAttr("y1")}}
  • -
  • {{SVGAttr("y2")}}
  • -
  • {{SVGAttr("yChannelSelector")}}
  • -
- -

Z

- -
    -
  • {{SVGAttr("z")}}
  • -
  • {{SVGAttr("zoomAndPan")}}
  • -
-
- -

SVG 属性(按类别分类)

- -

Generic Attributes

- -

核心属性

- -

{{SVGAttr("id")}}, {{SVGAttr("lang")}}, {{SVGAttr("tabindex")}}, {{SVGAttr("xml:base")}}, {{SVGAttr("xml:lang")}}, {{SVGAttr("xml:space")}}

- -

样式属性

- -

{{SVGAttr("class")}}, {{SVGAttr("style")}}

- -

条件处理属性

- -

{{SVGAttr("externalResourcesRequired")}}, {{SVGAttr("requiredExtensions")}}, {{SVGAttr("requiredFeatures")}}, {{SVGAttr("systemLanguage")}}.

- - - -

{{SVGAttr("xlink:href")}}, {{SVGAttr("xlink:type")}}, {{SVGAttr("xlink:role")}}, {{SVGAttr("xlink:arcrole")}}, {{SVGAttr("xlink:title")}}, {{SVGAttr("xlink:show")}}, {{SVGAttr("xlink:actuate")}}

- -

显示属性

- -
注意,所有 SVG 显示属性都可以作为 CSS 属性来使用。
- -

{{SVGAttr("alignment-baseline")}}, {{SVGAttr("baseline-shift")}}, {{SVGAttr("clip")}}, {{SVGAttr("clip-path")}}, {{SVGAttr("clip-rule")}}, {{SVGAttr("color")}}, {{SVGAttr("color-interpolation")}}, {{SVGAttr("color-interpolation-filters")}}, {{SVGAttr("color-profile")}}, {{SVGAttr("color-rendering")}}, {{SVGAttr("cursor")}}, {{SVGAttr("direction")}}, {{SVGAttr("display")}}, {{SVGAttr("dominant-baseline")}}, {{SVGAttr("enable-background")}}, {{SVGAttr("fill")}}, {{SVGAttr("fill-opacity")}}, {{SVGAttr("fill-rule")}}, {{SVGAttr("filter")}}, {{SVGAttr("flood-color")}}, {{SVGAttr("flood-opacity")}}, {{SVGAttr("font-family")}}, {{SVGAttr("font-size")}}, {{SVGAttr("font-size-adjust")}}, {{SVGAttr("font-stretch")}}, {{SVGAttr("font-style")}}, {{SVGAttr("font-variant")}}, {{SVGAttr("font-weight")}}, {{SVGAttr("glyph-orientation-horizontal")}}, {{SVGAttr("glyph-orientation-vertical")}}, {{SVGAttr("image-rendering")}}, {{SVGAttr("kerning")}}, {{SVGAttr("letter-spacing")}}, {{SVGAttr("lighting-color")}}, {{SVGAttr("marker-end")}}, {{SVGAttr("marker-mid")}}, {{SVGAttr("marker-start")}}, {{SVGAttr("mask")}}, {{SVGAttr("opacity")}}, {{SVGAttr("overflow")}}, {{SVGAttr("pointer-events")}}, {{SVGAttr("shape-rendering")}}, {{SVGAttr("stop-color")}}, {{SVGAttr("stop-opacity")}}, {{SVGAttr("stroke")}}, {{SVGAttr("stroke-dasharray")}}, {{SVGAttr("stroke-dashoffset")}}, {{SVGAttr("stroke-linecap")}}, {{SVGAttr("stroke-linejoin")}}, {{SVGAttr("stroke-miterlimit")}}, {{SVGAttr("stroke-opacity")}}, {{SVGAttr("stroke-width")}}, {{SVGAttr("text-anchor")}}, {{SVGAttr("transform")}}, {{SVGAttr("text-decoration")}}, {{SVGAttr("text-rendering")}}, {{SVGAttr("unicode-bidi")}}, {{SVGAttr("vector-effect")}}, {{SVGAttr("visibility")}}, {{SVGAttr("word-spacing")}}, {{SVGAttr("writing-mode")}}

- -

滤镜属性

- -

滤镜原始属性

- -

{{SVGAttr("height")}}, {{SVGAttr("result")}}, {{SVGAttr("width")}}, {{SVGAttr("x")}}, {{SVGAttr("y")}}

- -

传递函数属性

- -

{{SVGAttr("type")}}, {{SVGAttr("tableValues")}}, {{SVGAttr("slope")}}, {{SVGAttr("intercept")}}, {{SVGAttr("amplitude")}}, {{SVGAttr("exponent")}}, {{SVGAttr("offset")}}

- -

动画属性

- -

动画属性目标属性

- -

{{SVGAttr("attributeType")}}, {{SVGAttr("attributeName")}}

- -

动画时间属性

- -

{{SVGAttr("begin")}}, {{SVGAttr("dur")}}, {{SVGAttr("end")}}, {{SVGAttr("min")}}, {{SVGAttr("max")}}, {{SVGAttr("restart")}}, {{SVGAttr("repeatCount")}}, {{SVGAttr("repeatDur")}}, {{SVGAttr("fill")}}

- -

动画取值属性

- -

{{SVGAttr("calcMode")}}, {{SVGAttr("values")}}, {{SVGAttr("keyTimes")}}, {{SVGAttr("keySplines")}}, {{SVGAttr("from")}}, {{SVGAttr("to")}}, {{SVGAttr("by")}}, {{SVGAttr("autoReverse")}}, {{SVGAttr("accelerate")}}, {{SVGAttr("decelerate")}}

- -

动画额外属性

- -

{{SVGAttr("additive")}}, {{SVGAttr("accumulate")}}

- -

事件属性

- -

动画事件属性

- -

onbegin, onend, onrepeat

- -

文档事件属性

- -

onabort, onerror, onresize, onscroll, onunload

- -

全局事件属性

- -

oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting

- -

图像事件属性

- -

onactivate, onfocusin, onfocusout

- -

参见

- - diff --git a/files/zh-cn/web/svg/attribute/index.md b/files/zh-cn/web/svg/attribute/index.md new file mode 100644 index 00000000000000..76a242f2867a2e --- /dev/null +++ b/files/zh-cn/web/svg/attribute/index.md @@ -0,0 +1,424 @@ +--- +title: SVG 属性参考 +slug: Web/SVG/Attribute +tags: + - SVG + - SVG Attribute + - SVG Reference + - SVG 属性 + - 矢量图形 +translation_of: Web/SVG/Attribute +--- +{{SVGRef}} + +SVG 元素可以通过属性来修改,这些属性指定有关如何处理或呈现元素的详细信息。 下面列出了 SVG 中所有的可用属性以及参考文档的链接,以帮助您了解哪些元素支持它们,以及它们如何工作。 + +## SVG 属性(从 A-Z 排序) + +### A + +- {{SVGAttr("accent-height")}} +- {{SVGAttr("accumulate")}} +- {{SVGAttr("additive")}} +- {{SVGAttr("alignment-baseline")}} +- {{SVGAttr("allowReorder")}} +- {{SVGAttr("alphabetic")}} +- {{SVGAttr("amplitude")}} +- {{SVGAttr("arabic-form")}} +- {{SVGAttr("ascent")}} +- {{SVGAttr("attributeName")}} +- {{SVGAttr("attributeType")}} +- {{SVGAttr("autoReverse")}} +- {{SVGAttr("azimuth")}} + +### B + +- {{SVGAttr("baseFrequency")}} +- {{SVGAttr("baseline-shift")}} +- {{SVGAttr("baseProfile")}} +- {{SVGAttr("bbox")}} +- {{SVGAttr("begin")}} +- {{SVGAttr("bias")}} +- {{SVGAttr("by")}} + +### C + +- {{SVGAttr("calcMode")}} +- {{SVGAttr("cap-height")}} +- {{SVGAttr("class")}} +- {{SVGAttr("clip")}} +- {{SVGAttr("clipPathUnits")}} +- {{SVGAttr("clip-path")}} +- {{SVGAttr("clip-rule")}} +- {{SVGAttr("color")}} +- {{SVGAttr("color-interpolation")}} +- {{SVGAttr("color-interpolation-filters")}} +- {{SVGAttr("color-profile")}} +- {{SVGAttr("color-rendering")}} +- {{SVGAttr("contentScriptType")}} +- {{SVGAttr("contentStyleType")}} +- {{SVGAttr("cursor")}} +- {{SVGAttr("cx")}} +- {{SVGAttr("cy")}} + +### D + +- {{SVGAttr("d")}} +- {{SVGAttr("decelerate")}} +- {{SVGAttr("descent")}} +- {{SVGAttr("diffuseConstant")}} +- {{SVGAttr("direction")}} +- {{SVGAttr("display")}} +- {{SVGAttr("divisor")}} +- {{SVGAttr("dominant-baseline")}} +- {{SVGAttr("dur")}} +- {{SVGAttr("dx")}} +- {{SVGAttr("dy")}} + +### E + +- {{SVGAttr("edgeMode")}} +- {{SVGAttr("elevation")}} +- {{SVGAttr("enable-background")}} +- {{SVGAttr("end")}} +- {{SVGAttr("exponent")}} +- {{SVGAttr("externalResourcesRequired")}} + +### F + +- {{SVGAttr("fill")}} +- {{SVGAttr("fill-opacity")}} +- {{SVGAttr("fill-rule")}} +- {{SVGAttr("filter")}} +- {{SVGAttr("filterRes")}} +- {{SVGAttr("filterUnits")}} +- {{SVGAttr("flood-color")}} +- {{SVGAttr("flood-opacity")}} +- {{SVGAttr("font-family")}} +- {{SVGAttr("font-size")}} +- {{SVGAttr("font-size-adjust")}} +- {{SVGAttr("font-stretch")}} +- {{SVGAttr("font-style")}} +- {{SVGAttr("font-variant")}} +- {{SVGAttr("font-weight")}} +- {{SVGAttr("format")}} +- {{SVGAttr("from")}} +- {{SVGAttr("fr")}} +- {{SVGAttr("fx")}} +- {{SVGAttr("fy")}} + +### G + +- {{SVGAttr("g1")}} +- {{SVGAttr("g2")}} +- {{SVGAttr("glyph-name")}} +- {{SVGAttr("glyph-orientation-horizontal")}} +- {{SVGAttr("glyph-orientation-vertical")}} +- {{SVGAttr("glyphRef")}} +- {{SVGAttr("gradientTransform")}} +- {{SVGAttr("gradientUnits")}} + +### H + +- {{SVGAttr("hanging")}} +- {{SVGAttr("height")}} +- {{SVGAttr("href")}} +- {{SVGAttr("hreflang")}} +- {{SVGAttr("horiz-adv-x")}} +- {{SVGAttr("horiz-origin-x")}} + +### I + +- {{SVGAttr("id")}} +- {{SVGAttr("ideographic")}} +- {{SVGAttr("image-rendering")}} +- {{SVGAttr("in")}} +- {{SVGAttr("in2")}} +- {{SVGAttr("intercept")}} + +### K + +- {{SVGAttr("k")}} +- {{SVGAttr("k1")}} +- {{SVGAttr("k2")}} +- {{SVGAttr("k3")}} +- {{SVGAttr("k4")}} +- {{SVGAttr("kernelMatrix")}} +- {{SVGAttr("kernelUnitLength")}} +- {{SVGAttr("kerning")}} +- {{SVGAttr("keyPoints")}} +- {{SVGAttr("keySplines")}} +- {{SVGAttr("keyTimes")}} + +### L + +- {{SVGAttr("lang")}} +- {{SVGAttr("lengthAdjust")}} +- {{SVGAttr("letter-spacing")}} +- {{SVGAttr("lighting-color")}} +- {{SVGAttr("limitingConeAngle")}} +- {{SVGAttr("local")}} + +### M + +- {{SVGAttr("marker-end")}} +- {{SVGAttr("marker-mid")}} +- {{SVGAttr("marker-start")}} +- {{SVGAttr("markerHeight")}} +- {{SVGAttr("markerUnits")}} +- {{SVGAttr("markerWidth")}} +- {{SVGAttr("mask")}} +- {{SVGAttr("maskContentUnits")}} +- {{SVGAttr("maskUnits")}} +- {{SVGAttr("mathematical")}} +- {{SVGAttr("max")}} +- {{SVGAttr("media")}} +- {{SVGAttr("method")}} +- {{SVGAttr("min")}} +- {{SVGAttr("mode")}} + +### N + +- {{SVGAttr("name")}} +- {{SVGAttr("numOctaves")}} + +### O + +- {{SVGAttr("offset")}} +- {{SVGAttr("opacity")}} +- {{SVGAttr("operator")}} +- {{SVGAttr("order")}} +- {{SVGAttr("orient")}} +- {{SVGAttr("orientation")}} +- {{SVGAttr("origin")}} +- {{SVGAttr("overflow")}} +- {{SVGAttr("overline-position")}} +- {{SVGAttr("overline-thickness")}} + +### P + +- {{SVGAttr("panose-1")}} +- {{SVGAttr("paint-order")}} +- {{SVGAttr("path")}} +- {{SVGAttr("pathLength")}} +- {{SVGAttr("patternContentUnits")}} +- {{SVGAttr("patternTransform")}} +- {{SVGAttr("patternUnits")}} +- {{SVGAttr("ping")}} +- {{SVGAttr("pointer-events")}} +- {{SVGAttr("points")}} +- {{SVGAttr("pointsAtX")}} +- {{SVGAttr("pointsAtY")}} +- {{SVGAttr("pointsAtZ")}} +- {{SVGAttr("preserveAlpha")}} +- {{SVGAttr("preserveAspectRatio")}} +- {{SVGAttr("primitiveUnits")}} + +### R + +- {{SVGAttr("r")}} +- {{SVGAttr("radius")}} +- {{SVGAttr("referrerPolicy")}} +- {{SVGAttr("refX")}} +- {{SVGAttr("refY")}} +- {{SVGAttr("rel")}} +- {{SVGAttr("rendering-intent")}} +- {{SVGAttr("repeatCount")}} +- {{SVGAttr("repeatDur")}} +- {{SVGAttr("requiredExtensions")}} +- {{SVGAttr("requiredFeatures")}} +- {{SVGAttr("restart")}} +- {{SVGAttr("result")}} +- {{SVGAttr("rotate")}} +- {{SVGAttr("rx")}} +- {{SVGAttr("ry")}} + +### S + +- {{SVGAttr("scale")}} +- {{SVGAttr("seed")}} +- {{SVGAttr("shape-rendering")}} +- {{SVGAttr("slope")}} +- {{SVGAttr("spacing")}} +- {{SVGAttr("specularConstant")}} +- {{SVGAttr("specularExponent")}} +- {{SVGAttr("speed")}} +- {{SVGAttr("spreadMethod")}} +- {{SVGAttr("startOffset")}} +- {{SVGAttr("stdDeviation")}} +- {{SVGAttr("stemh")}} +- {{SVGAttr("stemv")}} +- {{SVGAttr("stitchTiles")}} +- {{SVGAttr("stop-color")}} +- {{SVGAttr("stop-opacity")}} +- {{SVGAttr("strikethrough-position")}} +- {{SVGAttr("strikethrough-thickness")}} +- {{SVGAttr("string")}} +- {{SVGAttr("stroke")}} +- {{SVGAttr("stroke-dasharray")}} +- {{SVGAttr("stroke-dashoffset")}} +- {{SVGAttr("stroke-linecap")}} +- {{SVGAttr("stroke-linejoin")}} +- {{SVGAttr("stroke-miterlimit")}} +- {{SVGAttr("stroke-opacity")}} +- {{SVGAttr("stroke-width")}} +- {{SVGAttr("style")}} +- {{SVGAttr("surfaceScale")}} +- {{SVGAttr("systemLanguage")}} + +### T + +- {{SVGAttr("tabindex")}} +- {{SVGAttr("tableValues")}} +- {{SVGAttr("target")}} +- {{SVGAttr("targetX")}} +- {{SVGAttr("targetY")}} +- {{SVGAttr("text-anchor")}} +- {{SVGAttr("text-decoration")}} +- {{SVGAttr("text-rendering")}} +- {{SVGAttr("textLength")}} +- {{SVGAttr("to")}} +- {{SVGAttr("transform")}} +- {{SVGAttr("type")}} + +### U + +- {{SVGAttr("u1")}} +- {{SVGAttr("u2")}} +- {{SVGAttr("underline-position")}} +- {{SVGAttr("underline-thickness")}} +- {{SVGAttr("unicode")}} +- {{SVGAttr("unicode-bidi")}} +- {{SVGAttr("unicode-range")}} +- {{SVGAttr("units-per-em")}} + +### V + +- {{SVGAttr("v-alphabetic")}} +- {{SVGAttr("v-hanging")}} +- {{SVGAttr("v-ideographic")}} +- {{SVGAttr("v-mathematical")}} +- {{SVGAttr("values")}} +- {{SVGAttr("vector-effect")}} +- {{SVGAttr("version")}} +- {{SVGAttr("vert-adv-y")}} +- {{SVGAttr("vert-origin-x")}} +- {{SVGAttr("vert-origin-y")}} +- {{SVGAttr("viewBox")}} +- {{SVGAttr("viewTarget")}} +- {{SVGAttr("visibility")}} + +### W + +- {{SVGAttr("width")}} +- {{SVGAttr("widths")}} +- {{SVGAttr("word-spacing")}} +- {{SVGAttr("writing-mode")}} + +### X + +- {{SVGAttr("x")}} +- {{SVGAttr("x-height")}} +- {{SVGAttr("x1")}} +- {{SVGAttr("x2")}} +- {{SVGAttr("xChannelSelector")}} +- {{SVGAttr("xlink:actuate")}} +- {{SVGAttr("xlink:arcrole")}} +- {{SVGAttr("xlink:href")}} +- {{SVGAttr("xlink:role")}} +- {{SVGAttr("xlink:show")}} +- {{SVGAttr("xlink:title")}} +- {{SVGAttr("xlink:type")}} +- {{SVGAttr("xml:base")}} +- {{SVGAttr("xml:lang")}} +- {{SVGAttr("xml:space")}} + +### Y + +- {{SVGAttr("y")}} +- {{SVGAttr("y1")}} +- {{SVGAttr("y2")}} +- {{SVGAttr("yChannelSelector")}} + +### Z + +- {{SVGAttr("z")}} +- {{SVGAttr("zoomAndPan")}} + +## SVG 属性(按类别分类) + +### Generic Attributes + +#### [核心属性](/docs/Web/SVG/Attribute/Core) + +{{SVGAttr("id")}}, {{SVGAttr("lang")}}, {{SVGAttr("tabindex")}}, {{SVGAttr("xml:base")}}, {{SVGAttr("xml:lang")}}, {{SVGAttr("xml:space")}} + +#### [样式属性](/docs/Web/SVG/Attribute/Styling) + +{{SVGAttr("class")}}, {{SVGAttr("style")}} + +#### 条件处理属性 + +{{SVGAttr("externalResourcesRequired")}}, {{SVGAttr("requiredExtensions")}}, {{SVGAttr("requiredFeatures")}}, {{SVGAttr("systemLanguage")}}. + +### XLink 属性 + +{{SVGAttr("xlink:href")}}, {{SVGAttr("xlink:type")}}, {{SVGAttr("xlink:role")}}, {{SVGAttr("xlink:arcrole")}}, {{SVGAttr("xlink:title")}}, {{SVGAttr("xlink:show")}}, {{SVGAttr("xlink:actuate")}} + +### [显示属性](/docs/Web/SVG/Attribute/Presentation) + +> **备注:** 所有 SVG 显示属性都可以作为 CSS 属性来使用。 + +{{SVGAttr("alignment-baseline")}}, {{SVGAttr("baseline-shift")}}, {{SVGAttr("clip")}}, {{SVGAttr("clip-path")}}, {{SVGAttr("clip-rule")}}, {{SVGAttr("color")}}, {{SVGAttr("color-interpolation")}}, {{SVGAttr("color-interpolation-filters")}}, {{SVGAttr("color-profile")}}, {{SVGAttr("color-rendering")}}, {{SVGAttr("cursor")}}, {{SVGAttr("direction")}}, {{SVGAttr("display")}}, {{SVGAttr("dominant-baseline")}}, {{SVGAttr("enable-background")}}, {{SVGAttr("fill")}}, {{SVGAttr("fill-opacity")}}, {{SVGAttr("fill-rule")}}, {{SVGAttr("filter")}}, {{SVGAttr("flood-color")}}, {{SVGAttr("flood-opacity")}}, {{SVGAttr("font-family")}}, {{SVGAttr("font-size")}}, {{SVGAttr("font-size-adjust")}}, {{SVGAttr("font-stretch")}}, {{SVGAttr("font-style")}}, {{SVGAttr("font-variant")}}, {{SVGAttr("font-weight")}}, {{SVGAttr("glyph-orientation-horizontal")}}, {{SVGAttr("glyph-orientation-vertical")}}, {{SVGAttr("image-rendering")}}, {{SVGAttr("kerning")}}, {{SVGAttr("letter-spacing")}}, {{SVGAttr("lighting-color")}}, {{SVGAttr("marker-end")}}, {{SVGAttr("marker-mid")}}, {{SVGAttr("marker-start")}}, {{SVGAttr("mask")}}, {{SVGAttr("opacity")}}, {{SVGAttr("overflow")}}, {{SVGAttr("pointer-events")}}, {{SVGAttr("shape-rendering")}}, {{SVGAttr("stop-color")}}, {{SVGAttr("stop-opacity")}}, {{SVGAttr("stroke")}}, {{SVGAttr("stroke-dasharray")}}, {{SVGAttr("stroke-dashoffset")}}, {{SVGAttr("stroke-linecap")}}, {{SVGAttr("stroke-linejoin")}}, {{SVGAttr("stroke-miterlimit")}}, {{SVGAttr("stroke-opacity")}}, {{SVGAttr("stroke-width")}}, {{SVGAttr("text-anchor")}}, {{SVGAttr("transform")}}, {{SVGAttr("text-decoration")}}, {{SVGAttr("text-rendering")}}, {{SVGAttr("unicode-bidi")}}, {{SVGAttr("vector-effect")}}, {{SVGAttr("visibility")}}, {{SVGAttr("word-spacing")}}, {{SVGAttr("writing-mode")}} + +### 滤镜属性 + +#### 滤镜原始属性 + +{{SVGAttr("height")}}, {{SVGAttr("result")}}, {{SVGAttr("width")}}, {{SVGAttr("x")}}, {{SVGAttr("y")}} + +#### 传递函数属性 + +{{SVGAttr("type")}}, {{SVGAttr("tableValues")}}, {{SVGAttr("slope")}}, {{SVGAttr("intercept")}}, {{SVGAttr("amplitude")}}, {{SVGAttr("exponent")}}, {{SVGAttr("offset")}} + +### 动画属性 + +#### 动画属性目标属性 + +{{SVGAttr("attributeType")}}, {{SVGAttr("attributeName")}} + +#### 动画时间属性 + +{{SVGAttr("begin")}}, {{SVGAttr("dur")}}, {{SVGAttr("end")}}, {{SVGAttr("min")}}, {{SVGAttr("max")}}, {{SVGAttr("restart")}}, {{SVGAttr("repeatCount")}}, {{SVGAttr("repeatDur")}}, {{SVGAttr("fill")}} + +#### 动画取值属性 + +{{SVGAttr("calcMode")}}, {{SVGAttr("values")}}, {{SVGAttr("keyTimes")}}, {{SVGAttr("keySplines")}}, {{SVGAttr("from")}}, {{SVGAttr("to")}}, {{SVGAttr("by")}}, {{SVGAttr("autoReverse")}}, {{SVGAttr("accelerate")}}, {{SVGAttr("decelerate")}} + +#### 动画额外属性 + +{{SVGAttr("additive")}}, {{SVGAttr("accumulate")}} + +### 事件属性 + +#### [动画事件属性](/docs/Web/SVG/Attribute/Events#Animation_Event_Attributes) + +**`onbegin`**, **`onend`**, **`onrepeat`** + +#### [文档事件属性](/docs/Web/SVG/Attribute/Events#Document_Event_Attributes) + +**`onabort`**, **`onerror`**, **`onresize`**, **`onscroll`**, **`onunload`** + +#### [全局事件属性](/docs/Web/SVG/Attribute/Events#Global_Event_Attributes) + +**`oncancel`**, **`oncanplay`**, **`oncanplaythrough`**, **`onchange`**, **`onclick`**, **`onclose`**, **`oncuechange`**, **`ondblclick`**, **`ondrag`**, **`ondragend`**, **`ondragenter`**, **`ondragexit`**, **`ondragleave`**, **`ondragover`**, **`ondragstart`**, **`ondrop`**, **`ondurationchange`**, **`onemptied`**, **`onended`**, **`onerror`**, **`onfocus`**, **`oninput`**, **`oninvalid`**, **`onkeydown`**, **`onkeypress`**, **`onkeyup`**, **`onload`**, **`onloadeddata`**, **`onloadedmetadata`**, **`onloadstart`**, **`onmousedown`**, **`onmouseenter`**, **`onmouseleave`**, **`onmousemove`**, **`onmouseout`**, **`onmouseover`**, **`onmouseup`**, **`onmousewheel`**, **`onpause`**, **`onplay`**, **`onplaying`**, **`onprogress`**, **`onratechange`**, **`onreset`**, **`onresize`**, **`onscroll`**, **`onseeked`**, **`onseeking`**, **`onselect`**, **`onshow`**, **`onstalled`**, **`onsubmit`**, **`onsuspend`**, **`ontimeupdate`**, **`ontoggle`**, **`onvolumechange`**, **`onwaiting`** + +#### [图像事件属性](/docs/Web/SVG/Attribute/Events#Graphical_Event_Attributes) + +**`onactivate`**, **`onfocusin`**, **`onfocusout`** + +## 参见 + +- [SVG 元素参考](/zh-CN/docs/Web/SVG/Element) +- [SVG 教程](/zh-CN/docs/Web/SVG/Tutorial) +- [SVG 接口参考](/zh-CN/docs/Web/API/Document_Object_Model#SVG_interfaces) diff --git a/files/zh-cn/web/svg/attribute/kernelmatrix/index.html b/files/zh-cn/web/svg/attribute/kernelmatrix/index.html deleted file mode 100644 index c3e0ce4efcde70..00000000000000 --- a/files/zh-cn/web/svg/attribute/kernelmatrix/index.html +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: kernelMatrix -slug: Web/SVG/Attribute/kernelMatrix -translation_of: Web/SVG/Attribute/kernelMatrix ---- -

« SVG Attribute reference home

- -

用于 order 属性定义一列<number>为{{SVGElement("feConvolveMatrix")}} 元素构成核矩阵。值之间用空格或逗号分开。<number>的数量必须等于在{{SVGAttr("order")}}属性中定义的<orderX>和<orderY>的乘积。

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesNone
ValueT<.2Fvar>s"><list of number>
AnimatableYes
- -

Example

- -

Elements

- -

下面的元素可以使用kernelMatrix 属性

- -
    -
  • {{ SVGElement("feConvolveMatrix") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/kernelmatrix/index.md b/files/zh-cn/web/svg/attribute/kernelmatrix/index.md new file mode 100644 index 00000000000000..8aa23c87b837f6 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/kernelmatrix/index.md @@ -0,0 +1,27 @@ +--- +title: kernelMatrix +slug: Web/SVG/Attribute/kernelMatrix +translation_of: Web/SVG/Attribute/kernelMatrix +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +用于 order 属性定义一列[\](/en/SVG/Content_type#Number)为{{SVGElement("feConvolveMatrix")}} 元素构成核矩阵。值之间用空格或逗号分开。[\](/en/SVG/Content_type#Number)的数量必须等于在{{SVGAttr("order")}}属性中定义的\和\的乘积。 + +## Usage context + +| Categories | None | +| ---------- | ---------------------------------------------------------------------------- | +| Value | [T<.2Fvar>s">](/en/SVG/Content_type#List-of-T<.2Fvar>s) | +| Animatable | Yes | + +## Example + +## Elements + +下面的元素可以使用`kernelMatrix 属性` + +- {{ SVGElement("feConvolveMatrix") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/keytimes/index.html b/files/zh-cn/web/svg/attribute/keytimes/index.html deleted file mode 100644 index fc4caa1f47d515..00000000000000 --- a/files/zh-cn/web/svg/attribute/keytimes/index.html +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: keyTimes -slug: Web/SVG/Attribute/keyTimes -tags: - - SVG - - SVG 属性 - - keyTimes -translation_of: Web/SVG/Attribute/keyTimes ---- -

« SVG 属性参考主页

- -

keyTimes 属性是一个以分号分隔的时间值列表,用于控制动画的执行步骤。列表中的每个值与{{ SVGAttr("values") }}中的值一一对应,定义了{{ SVGAttr("values") }}中的值在动画中何时执行,keyTimes 列表中的每一个值都是指定在 [0-1] 之间的浮点数,表示动画的完成时间。

- -

如果指定了 keyTimes 列表,那么一定有与之完全对应的{{ SVGAttr("values") }}列表。

- -

每一个连续的时间值必须大于等于前一个时间值。

- -

keyTimes 列表的语义取决于插值模式:

- -
    -
  • 对于 linear(线性) 和 spline(样条) 动画,列表中的第一个时间值必须为 0,列表的最后一个时间值必须为 1。与每个 value 关联的时间值定义了何时设置该 value,该 value 在 keyTimes 的时间 值的中间插值。
  • -
  • 对于 discrete(离线) 动画,列表中的第一个值必须为 0。与每个 value 关联的时间值定义了何时设置该 value,动画函数使用该 value,直到 keyTimes 中定义的下一个时间值。
  • -
- -

- -

- -
    -
- -

- -

如果插值模式是 paced(踏步),keyTimes 属性被忽略。

- -

如果 duration(持续时间)不确定,则将忽略任何 keyTimes 规范。

- -

用法

- - - - - - - - - - - - - - - - -
类别动画值属性
<list>
可变性No
- -

示例

- -
<?xml version="1.0"?>
-<svg width="120" height="120"
-     viewPort="0 0 120 120" version="1.1"
-     xmlns="http://www.w3.org/2000/svg">
-
-    <circle cx="60" cy="10" r="10">
-
-        <animate attributeName="cx"
-                 attributeType="XML"
-                 dur="4s"
-                 values="60 ; 110 ; 60 ; 10 ; 60"
-                 keyTimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"
-                 repeatCount="indefinite"/>
-
-        <animate attributeName="cy"
-                 attributeType="XML"
-                 dur="4s"
-                 values="10 ; 60 ; 110 ; 60 ; 10 "
-                 keyTimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"
-                 repeatCount="indefinite"/>
-
-    </circle>
-</svg>
-
- -

元素

- -

以下元素可以使用 keyTimes 属性

- -
    -
  • {{ SVGElement("animate") }}
  • -
  • {{ SVGElement("animateColor") }}
  • -
  • {{ SVGElement("animateMotion") }}
  • -
  • {{ SVGElement("animateTransform") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/keytimes/index.md b/files/zh-cn/web/svg/attribute/keytimes/index.md new file mode 100644 index 00000000000000..0887b07ed1e4e7 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/keytimes/index.md @@ -0,0 +1,73 @@ +--- +title: keyTimes +slug: Web/SVG/Attribute/keyTimes +tags: + - SVG + - SVG 属性 + - keyTimes +translation_of: Web/SVG/Attribute/keyTimes +--- +« [SVG ](/zh-CN/docs/Web/SVG/Attribute)属性参考主页 + +keyTimes 属性是一个以分号分隔的时间值列表,用于控制动画的执行步骤。列表中的每个值与{{ SVGAttr("values") }}中的值一一对应,定义了{{ SVGAttr("values") }}中的值在动画中何时执行,keyTimes 列表中的每一个值都是指定在 \[0-1] 之间的浮点数,表示动画的完成时间。 + +如果指定了 keyTimes 列表,那么一定有与之完全对应的{{ SVGAttr("values") }}列表。 + +每一个连续的时间值必须大于等于前一个时间值。 + +keyTimes 列表的语义取决于插值模式: + +- 对于 linear(线性) 和 spline(样条) 动画,列表中的第一个时间值必须为 0,列表的最后一个时间值必须为 1。与每个 value 关联的时间值定义了何时设置该 value,该 value 在 keyTimes 的时间 值的中间插值。 +- 对于 discrete(离线) 动画,列表中的第一个值必须为 0。与每个 value 关联的时间值定义了何时设置该 value,动画函数使用该 value,直到 keyTimes 中定义的下一个时间值。 + +如果插值模式是 paced(踏步),keyTimes 属性被忽略。 + +如果 duration(持续时间)不确定,则将忽略任何 keyTimes 规范。 + +## 用法 + +| 类别 | 动画值属性 | +| ------ | ---------- | +| 值 | | +| 可变性 | No | + +## 示例 + +```html + + + + + + + + + + + +``` + +## 元素 + +以下元素可以使用 `keyTimes 属性` + +- {{ SVGElement("animate") }} +- {{ SVGElement("animateColor") }} +- {{ SVGElement("animateMotion") }} +- {{ SVGElement("animateTransform") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/letter-spacing/index.html b/files/zh-cn/web/svg/attribute/letter-spacing/index.html deleted file mode 100644 index 31bb91be7b9fab..00000000000000 --- a/files/zh-cn/web/svg/attribute/letter-spacing/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: letter-spacing -slug: Web/SVG/Attribute/letter-spacing -translation_of: Web/SVG/Attribute/letter-spacing ---- -
{{SVGRef}}
- -

The letter-spacing attribute controls spacing between text characters, in addition to any spacing from the {{SVGAttr("kerning")}} attribute.

- -

If the attribute value is a unitless number (like 128), the browser processes it as a {{cssxref("length")}} in the current user coordinate system.

- -

If the attribute value has a unit identifier, such as .25em or 1%, then the browser converts the <length> into its corresponding value in the current user coordinate system.

- -

Note: As a presentation attribute, letter-spacing can be used as a CSS property. See the {{cssxref("letter-spacing", "CSS letter-spacing")}} property for more information.

- -

As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: {{SVGElement("altGlyph")}}, {{SVGElement("text")}}, {{SVGElement("textPath")}}, {{SVGElement("tref")}}, and {{SVGElement("tspan")}}

- -
- - -
<svg viewBox="0 0 400 30" xmlns="http://www.w3.org/2000/svg">
-  <text y="20" letter-spacing="2">Bigger letter-spacing</text>
-  <text x="200" y="20" letter-spacing="-0.5">Smaller letter-spacing</text>
-</svg>
- -

{{EmbedLiveSample("topExample", "200", "30")}}

-
- -

Usage notes

- - - - - - - - - - - - - - - - -
Valuenormal | {{cssxref("length")}}
Default valuenormal
AnimatableYes
- -

For a description of the values, please refer to the CSS letter-spacing property.

- -

As of May 2019, Firefox ignores letter-spacing and renders text without.

- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

- -

See also

- -
    -
  • {{cssxref("letter-spacing", "CSS letter-spacing")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/letter-spacing/index.md b/files/zh-cn/web/svg/attribute/letter-spacing/index.md new file mode 100644 index 00000000000000..e119dcc9a41744 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/letter-spacing/index.md @@ -0,0 +1,56 @@ +--- +title: letter-spacing +slug: Web/SVG/Attribute/letter-spacing +translation_of: Web/SVG/Attribute/letter-spacing +--- +{{SVGRef}} + +The **`letter-spacing`** attribute controls spacing between text characters, in addition to any spacing from the {{SVGAttr("kerning")}} attribute. + +If the attribute value is a unitless number (like `128`), the browser processes it as a {{cssxref("length")}} in the current user coordinate system. + +If the attribute value has a unit identifier, such as `.25em` or `1%`, then the browser converts the \ into its corresponding value in the current user coordinate system. + +**Note:** As a presentation attribute, `letter-spacing` can be used as a CSS property. See the {{cssxref("letter-spacing", "CSS letter-spacing")}} property for more information. + +As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: {{SVGElement("altGlyph")}}, {{SVGElement("text")}}, {{SVGElement("textPath")}}, {{SVGElement("tref")}}, and {{SVGElement("tspan")}} + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + Bigger letter-spacing + Smaller letter-spacing + +``` + +{{EmbedLiveSample("示例", "200", "30")}} + +## Usage notes + +| Value | `normal` \| {{cssxref("length")}} | +| ------------- | ---------------------------------------- | +| Default value | `normal` | +| Animatable | Yes | + +For a description of the values, please refer to the [CSS `letter-spacing`](/zh-CN/docs/Web/CSS/letter-spacing#Values) property. + +As of May 2019, Firefox [ignores `letter-spacing`](https://bugzilla.mozilla.org/show_bug.cgi?id=371787) and renders text without. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{cssxref("letter-spacing", "CSS letter-spacing")}} diff --git a/files/zh-cn/web/svg/attribute/marker-end/index.html b/files/zh-cn/web/svg/attribute/marker-end/index.html deleted file mode 100644 index 6fea4a0d736023..00000000000000 --- a/files/zh-cn/web/svg/attribute/marker-end/index.html +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: marker-end -slug: Web/SVG/Attribute/marker-end -translation_of: Web/SVG/Attribute/marker-end ---- -
{{SVGRef}}
- -

marker-end 属性将在给定形状的最终顶点绘制的箭头或者多边形标记。

- -

对于除 SVG 的 polyline 和 path 元素之外的所有形状元素,最后的一个顶点与第一个顶点相同。在这种情况下,如果 SVG 的 marker-start 属性和 marker-end 的值都不是 none ,然后再最后一个顶点渲染两个图标。 对于一个 <path> 元素, 对于每个封闭的子路径,他的最后一个顶点都与第一个顶点相同。 marker-end 仅在路径数据的最终顶点上呈现。

- -

Note: 作为一个图像属性,marker-end 可以用作 CSS 属性。

- -

作为一个图像属性,他可以应用到所有的元素上,但是他只针对于一下其中元素有效: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, and {{SVGElement("rect")}}

- -
- - -
<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
-  <defs>
-    <marker id="triangle" viewBox="0 0 10 10"
-          refX="1" refY="5"
-          markerUnits="strokeWidth"
-          markerWidth="10" markerHeight="10"
-          orient="auto">
-      <path d="M 0 0 L 10 5 L 0 10 z" fill="#f00"/>
-    </marker>
-  </defs>
-  <polyline fill="none" stroke="black"
-      points="20,100 40,60 70,80 100,20" marker-end="url(#triangle)"/>
-</svg>
-
- -

{{EmbedLiveSample("topExample", "200", "200")}}

-
- -

使用说明

- - - - - - - - - - - - - - - - -
Valuenone | <marker-ref>
Default valuenone
AnimatableYes
- -
-
none
-
表示将不会在终点绘制任何符号。
-
<marker-ref>
-
这个值表示的是对 {{SVGElement("marker")}} 元素的引用,将在终点绘制该元素.。如果引用无效,将不会绘制任何东西。
-
- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

- -

另见

- -
    -
  • {{SVGElement("marker")}}
  • -
  • {{SVGAttr("marker-start")}}
  • -
  • {{SVGAttr("marker-mid")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/marker-end/index.md b/files/zh-cn/web/svg/attribute/marker-end/index.md new file mode 100644 index 00000000000000..d6ae6f9eb4a15a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/marker-end/index.md @@ -0,0 +1,66 @@ +--- +title: marker-end +slug: Web/SVG/Attribute/marker-end +translation_of: Web/SVG/Attribute/marker-end +--- +{{SVGRef}} + +**`marker-end`** 属性将在给定[形状](/zh-CN/docs/Web/SVG/Element#Shape_elements)的最终顶点绘制的箭头或者多边形标记。 + +对于除 SVG 的 polyline 和 path 元素之外的所有形状元素,最后的一个顶点与第一个顶点相同。在这种情况下,如果 SVG 的 marker-start 属性和 `marker-end` 的值都不是 `none` ,然后再最后一个顶点渲染两个图标。 对于一个 `` 元素, 对于每个封闭的子路径,他的最后一个顶点都与第一个顶点相同。 `marker-end` 仅在[路径数据](/zh-CN/docs/Web/SVG/Attribute/d#Path_commands)的最终顶点上呈现。 + +**Note:** 作为一个图像属性,`marker-end` 可以用作 CSS 属性。 + +作为一个图像属性,他可以应用到所有的元素上,但是他只针对于一下其中元素有效: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, and {{SVGElement("rect")}} + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + + + + + + + +``` + +{{EmbedLiveSample("示例", "200", "200")}} + +## 使用说明 + +| Value | `none` \| `` | +| ------------- | ------------------------ | +| Default value | `none` | +| Animatable | Yes | + +- `none` + - : 表示将不会在终点绘制任何符号。 +- `` + - : 这个值表示的是对 {{SVGElement("marker")}} 元素的引用,将在终点绘制该元素.。如果引用无效,将不会绘制任何东西。 + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} + +## 另见 + +- {{SVGElement("marker")}} +- {{SVGAttr("marker-start")}} +- {{SVGAttr("marker-mid")}} diff --git a/files/zh-cn/web/svg/attribute/marker-start/index.html b/files/zh-cn/web/svg/attribute/marker-start/index.html deleted file mode 100644 index 8034303423f9ba..00000000000000 --- a/files/zh-cn/web/svg/attribute/marker-start/index.html +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: marker-start -slug: Web/SVG/Attribute/marker-start -translation_of: Web/SVG/Attribute/marker-start ---- -
{{SVGRef}}
- -

marker-start 属性将在给定形状的起始顶点绘制的箭头或者多边形标记

- -

对于除 SVG 的 polyline 和 path 元素之外的所有形状元素,最后的一个顶点与第一个顶点相同。在这种情况下,如果 SVG 的marker-start属性和 {{SVGAttr("marker-end")}} 的值都不是 none ,然后再最后一个顶点渲染两个图标。 对于一个 <path> 元素, 对于每个封闭的子路径,他的最后一个顶点都与第一个顶点相同。 marker-end 仅在路径数据的起始顶点上呈现。

- -

Note:作为一个图像属性, marker-start 可以用作 CSS 属性。

- -

作为一个图像属性,他可以应用到所有的元素上,但是他只针对于一下其中元素有效: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, 和{{SVGElement("rect")}}

- -
- - -
<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
-  <defs>
-    <marker id="triangle" viewBox="0 0 10 10"
-          refX="1" refY="5"
-          markerUnits="strokeWidth"
-          markerWidth="10" markerHeight="10"
-          orient="auto">
-      <path d="M 0 0 L 10 5 L 0 10 z" fill="#f00"/>
-    </marker>
-  </defs>
-  <polyline fill="none" stroke="black"
-      points="20,100 40,60 70,80 100,20" marker-start="url(#triangle)"/>
-</svg>
-
- -

{{EmbedLiveSample("topExample", "200", "200")}}

-
- -

使用说明

- - - - - - - - - - - - - - - - -
none | <marker-ref>
默认值none
可用作与动画
- -
-
none
-
表示将不会在起点绘制任何符号。
-
<marker-ref>
-
这个值表示的是对 <marker> 元素的引用,将在起点绘制该元素.。如果引用无效,将不会绘制任何东西。
-
- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

- -

另见

- -
    -
  • {{SVGElement("marker")}}
  • -
  • {{SVGAttr("marker-end")}}
  • -
  • {{SVGAttr("marker-mid")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/marker-start/index.md b/files/zh-cn/web/svg/attribute/marker-start/index.md new file mode 100644 index 00000000000000..0f3c97597f6450 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/marker-start/index.md @@ -0,0 +1,66 @@ +--- +title: marker-start +slug: Web/SVG/Attribute/marker-start +translation_of: Web/SVG/Attribute/marker-start +--- +{{SVGRef}} + +**`marker-start`** 属性将在给定[形状](/zh-CN/docs/Web/SVG/Element#Shape_elements)的起始顶点绘制的箭头或者多边形标记 + +对于除 SVG 的 polyline 和 path 元素之外的所有形状元素,最后的一个顶点与第一个顶点相同。在这种情况下,如果 SVG 的`marker-start`属性和 {{SVGAttr("marker-end")}} 的值都不是 `none` ,然后再最后一个顶点渲染两个图标。 对于一个 `` 元素, 对于每个封闭的子路径,他的最后一个顶点都与第一个顶点相同。 `marker-end` 仅在[路径数据](/zh-CN/docs/Web/SVG/Attribute/d#Path_commands)的起始顶点上呈现。 + +**Note:**作为一个图像属性, `marker-start` 可以用作 CSS 属性。 + +作为一个图像属性,他可以应用到所有的元素上,但是他只针对于一下其中元素有效: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, 和{{SVGElement("rect")}} + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + + + + + + + +``` + +{{EmbedLiveSample("示例", "200", "200")}} + +## 使用说明 + +| 值 | `none` \| `` | +| ------------ | ------------------------ | +| 默认值 | `none` | +| 可用作与动画 | 是 | + +- `none` + - : 表示将不会在起点绘制任何符号。 +- `` + - : 这个值表示的是对 [``](/zh-CN/docs/Web/SVG/Element/marker) 元素的引用,将在起点绘制该元素.。如果引用无效,将不会绘制任何东西。 + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} + +## 另见 + +- {{SVGElement("marker")}} +- {{SVGAttr("marker-end")}} +- {{SVGAttr("marker-mid")}} diff --git a/files/zh-cn/web/svg/attribute/mask/index.html b/files/zh-cn/web/svg/attribute/mask/index.html deleted file mode 100644 index 2e8b53272b2698..00000000000000 --- a/files/zh-cn/web/svg/attribute/mask/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: mask -slug: Web/SVG/Attribute/mask -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/mask ---- -

« SVG 属性参考主页

- -

mask属性绑定的元素将应用给定的{{ SVGElement("mask") }}元素。

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<FuncIRI> | none | inherit
可变性Yes
- -
-
<funcIRI>
-
对同一 SVG 文档片段内部别的图形对象的一个引用 ,这个图形对象将用作遮罩。这个引用的句法与{{ cssxref("uri","CSS URI") }}的句法相同。
-
- -

示例

- -

元素

- -

下列元素可以使用mask属性:

- - - -

规范

- -{{Specifications}} - -

相关内容

- -
    -
  • {{ SVGElement("mask") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/mask/index.md b/files/zh-cn/web/svg/attribute/mask/index.md new file mode 100644 index 00000000000000..c2721074ec41da --- /dev/null +++ b/files/zh-cn/web/svg/attribute/mask/index.md @@ -0,0 +1,41 @@ +--- +title: mask +slug: Web/SVG/Attribute/mask +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/mask +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`mask`属性绑定的元素将应用给定的{{ SVGElement("mask") }}元素。 + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | ---------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#FuncIRI) \| **none** \| inherit | +| 可变性 | Yes | + +- [\](/en/SVG/Content_type#FuncIRI) + - : 对同一 SVG 文档片段内部别的图形对象的一个引用 ,这个图形对象将用作遮罩。这个引用的句法与{{ cssxref("uri","CSS URI") }}的句法相同。 + +## 示例 + +## 元素 + +下列元素可以使用`mask`属性: + +- [容器元素](/en/SVG/Element#Container) » +- [图形元素](/en/SVG/Element#Graphical) » + +## 规范 + +{{Specifications}} + +## 相关内容 + +- {{ SVGElement("mask") }} diff --git a/files/zh-cn/web/svg/attribute/max/index.html b/files/zh-cn/web/svg/attribute/max/index.html deleted file mode 100644 index 89eaa7eb31a091..00000000000000 --- a/files/zh-cn/web/svg/attribute/max/index.html +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: max -slug: Web/SVG/Attribute/max -translation_of: Web/SVG/Attribute/max ---- -
{{SVGRef}}
- -

The max attribute specifies the maximum value of the active animation duration.

- -

Five elements are using this attribute: {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, {{SVGElement("animateTransform")}}, and {{SVGElement("set")}}

- -
- - -
<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
-  <circle cx="60" cy="10" r="10">
-    <animate attributeName="cx" dur="4s" max="6s" repeatCount="indefinite"
-        values="60 ; 110 ; 60 ; 10 ; 60" keyTimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/>
-    <animate attributeName="cy" dur="4s" max="6s" repeatCount="indefinite"
-        values="10 ; 60 ; 110 ; 60 ; 10" keyTimes="0 ; 0.25 ; 0.5 ; 0.75 ; 1"/>
-  </circle>
-</svg>
- -

{{EmbedLiveSample("topExample", "200", "200")}}

-
- -

Usage notes

- - - - - - - - - - - - - - - - -
Value<clock-value>
Default valueNone
AnimatableNo
- -
-
<clock-value>
-
-

Specifies the length of the maximum value of the active duration, measured in local time. The value must be greater than 0.

-
-
- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

- -

See also

- -
    -
  • {{SVGAttr("min")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/max/index.md b/files/zh-cn/web/svg/attribute/max/index.md new file mode 100644 index 00000000000000..2054a73f7387e4 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/max/index.md @@ -0,0 +1,53 @@ +--- +title: max +slug: Web/SVG/Attribute/max +translation_of: Web/SVG/Attribute/max +--- +{{SVGRef}} + +The **`max`** attribute specifies the maximum value of the active animation duration. + +Five elements are using this attribute: {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, {{SVGElement("animateTransform")}}, and {{SVGElement("set")}} + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + + + + + +``` + +{{EmbedLiveSample("示例", "200", "200")}} + +## Usage notes + +| Value | [``](/en-US/docs/Web/SVG/Content_type#Clock-value) | +| ------------- | --------------------------------------------------------------- | +| Default value | _None_ | +| Animatable | No | + +- `` + - : Specifies the length of the maximum value of the active duration, measured in local time. The value must be greater than 0. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{SVGAttr("min")}} diff --git a/files/zh-cn/web/svg/attribute/media/index.html b/files/zh-cn/web/svg/attribute/media/index.html deleted file mode 100644 index 73746cacfdc65b..00000000000000 --- a/files/zh-cn/web/svg/attribute/media/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: media -slug: Web/SVG/Attribute/media -translation_of: Web/SVG/Attribute/media ---- -
{{SVGRef}}
- -

media属性指定只有符合{{Glossary("media query")}}的样式表才会被应用。

- -

只有一个元素使用这个属性: {{SVGElement("style")}}

- -
- - -
<svg viewBox="0 0 240 220" xmlns="http://www.w3.org/2000/svg">
-  <style>
-    rect { fill: black; }
-  </style>
-  <style media="all and (min-width: 600px)">
-    rect { fill: seagreen; }
-  </style>
-
-  <text y="15">Resize the window to see the effect</text>
-  <rect y="20" width="200" height="200" />
-</svg>
- -

{{EmbedLiveSample("topExample", "200", "200")}}

-
- -

Usage notes

- - - - - - - - - - - - - - - - -
Value<media-query-list>
Default valueall
AnimatableYes
- -
-
<media-query-list>
-
-

This value holds a media query that needs to match in order for the style sheet to be applied.

- -

如果没有指定,样式表就会被应用。

-
-
- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/media/index.md b/files/zh-cn/web/svg/attribute/media/index.md new file mode 100644 index 00000000000000..1e33bca1aec5d1 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/media/index.md @@ -0,0 +1,52 @@ +--- +title: media +slug: Web/SVG/Attribute/media +translation_of: Web/SVG/Attribute/media +--- +{{SVGRef}} + +**`media`**属性指定只有符合{{Glossary("media query")}}的样式表才会被应用。 + +只有一个元素使用这个属性: {{SVGElement("style")}} + +## 示例 + +```css hidden +html, body, svg { + height: 100%; +} +``` + +```html + + + + + Resize the window to see the effect + + +``` + +{{EmbedLiveSample("示例", "200", "200")}} + +## Usage notes + +| Value | [``](/en-US/docs/Web/CSS/@media#media-query-list) | +| ------------- | ------------------------------------------------------------------- | +| Default value | `all` | +| Animatable | Yes | + +- `` + - : This value holds a media query that needs to match in order for the style sheet to be applied.如果没有指定,样式表就会被应用。 + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/opacity/index.html b/files/zh-cn/web/svg/attribute/opacity/index.html deleted file mode 100644 index 9955a5152f9a9d..00000000000000 --- a/files/zh-cn/web/svg/attribute/opacity/index.html +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: opacity -slug: Web/SVG/Attribute/opacity -tags: - - SVG - - SVG 属性 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/opacity ---- -

« SVG 属性参考主页

- -

opacity 属性指定了一个对象或一组对象的透明度,也就是说,元素后面的背景的透过率。

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性,请阅读 {{ cssxref("opacity","CSS opacity") }}以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<opacity-value> | inherit
可变性Yes
- -
-
<opacity-value>
-
一致的不透明度设置,作为一个<number>被应用到整个对象上。任何超过范围 0.0 到 1.0 的值都会被压回这个范围。0.0 表示完全透明,1.0 表示完全不透明。
-
- -

示例

- -

元素

- -

以下元素可以使用opacity属性:

- -
    -
  • 图形元素 »
  • -
  • {{ SVGElement("a") }}
  • -
  • {{ SVGElement("defs") }}
  • -
  • {{ SVGElement("glyph") }}
  • -
  • {{ SVGElement("g") }}
  • -
  • {{ SVGElement("marker") }}
  • -
  • {{ SVGElement("missing-glyph") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("switch") }}
  • -
  • {{ SVGElement("symbol") }}
  • -
- -

规范

- -{{Specifications}} - -

参见

- -
    -
  • {{ cssxref("opacity","CSS opacity") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/opacity/index.md b/files/zh-cn/web/svg/attribute/opacity/index.md new file mode 100644 index 00000000000000..66e88aeaa2869a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/opacity/index.md @@ -0,0 +1,51 @@ +--- +title: opacity +slug: Web/SVG/Attribute/opacity +tags: + - SVG + - SVG 属性 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/opacity +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +opacity 属性指定了一个对象或一组对象的透明度,也就是说,元素后面的背景的透过率。 + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性,请阅读 {{ cssxref("opacity","CSS opacity") }}以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | -------------------------- | +| 值 | \| inherit | +| 可变性 | Yes | + +- \ + - : 一致的不透明度设置,作为一个[\](/en/SVG/Content_type#Number)被应用到整个对象上。任何超过范围 0.0 到 1.0 的值都会被压回这个范围。0.0 表示完全透明,1.0 表示完全不透明。 + +## 示例 + +## 元素 + +以下元素可以使用`opacity`属性: + +- [图形元素](/en/SVG/Element#Graphics) » +- {{ SVGElement("a") }} +- {{ SVGElement("defs") }} +- {{ SVGElement("glyph") }} +- {{ SVGElement("g") }} +- {{ SVGElement("marker") }} +- {{ SVGElement("missing-glyph") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("switch") }} +- {{ SVGElement("symbol") }} + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ cssxref("opacity","CSS opacity") }} diff --git a/files/zh-cn/web/svg/attribute/order/index.html b/files/zh-cn/web/svg/attribute/order/index.html deleted file mode 100644 index 6fd86bd1dbb3fd..00000000000000 --- a/files/zh-cn/web/svg/attribute/order/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: order -slug: Web/SVG/Attribute/order -translation_of: Web/SVG/Attribute/order ---- -

« SVG Attribute reference home

- -

order 属性确定被用作{{ SVGElement("feConvolveMatrix") }}元素的矩阵的大小。

- -

提供的值必须是大于 0 的<整数>. 第一个值<orderX>,确定矩阵的列数。第二个值<orderY>确定矩阵的行数。如果<orderY>没有指定,那么它的默认值相当于<orderX>的值。

- -

一个典型的值是 order="3". 建议只使用较小的值 (例如 3); 大值可能会导致较高的 CPU 开销而且通常界面上并不能表现出高耗能造成的效果。

- -

如果未指定该属性,则其效果就如同指定值为 3.

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesNone
Value<number-optional-number>
AnimatableYes
- -

Example

- -

Elements

- -

下列元素可以使用 order 属性

- -
    -
  • {{ SVGElement("feConvolveMatrix") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/order/index.md b/files/zh-cn/web/svg/attribute/order/index.md new file mode 100644 index 00000000000000..4f032e4ee56878 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/order/index.md @@ -0,0 +1,33 @@ +--- +title: order +slug: Web/SVG/Attribute/order +translation_of: Web/SVG/Attribute/order +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +order 属性确定被用作{{ SVGElement("feConvolveMatrix") }}元素的矩阵的大小。 + +提供的值必须是大于 0 的[<整数>](/en/SVG/Content_type#Integer). 第一个值\,确定矩阵的列数。第二个值\确定矩阵的行数。如果\没有指定,那么它的默认值相当于\的值。 + +一个典型的值是 order="3". 建议只使用较小的值 (例如 3); 大值可能会导致较高的 CPU 开销而且通常界面上并不能表现出高耗能造成的效果。 + +如果未指定该属性,则其效果就如同指定值为 3. + +## Usage context + +| Categories | None | +| ---------- | ----------------------------------------------------------------------- | +| Value | [](/en/SVG/Content_type#Number-optional-number) | +| Animatable | Yes | + +## Example + +## Elements + +下列元素可以使用 order 属性 + +- {{ SVGElement("feConvolveMatrix") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/origin/index.html b/files/zh-cn/web/svg/attribute/origin/index.html deleted file mode 100644 index c09cdea538aaa4..00000000000000 --- a/files/zh-cn/web/svg/attribute/origin/index.html +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: origin -slug: Web/SVG/Attribute/origin -translation_of: Web/SVG/Attribute/origin ---- -
{{SVGRef}}
- -

origin属性指定动画的运动原点。在 SVG 中无效。

- -

只有一个元素正在使用此属性:{{SVGElement("animateMotion")}}

- -

总体注释

- - - - - - - - - - - - - - - - -
default
默认值default
可动画的没有
- -

规范

- -{{Specifications}} - -

也可以看看

- - diff --git a/files/zh-cn/web/svg/attribute/origin/index.md b/files/zh-cn/web/svg/attribute/origin/index.md new file mode 100644 index 00000000000000..71722488e14457 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/origin/index.md @@ -0,0 +1,25 @@ +--- +title: origin +slug: Web/SVG/Attribute/origin +translation_of: Web/SVG/Attribute/origin +--- +{{SVGRef}} + +该**`origin`**属性指定动画的运动原点。在 SVG 中无效。 + +只有一个元素正在使用此属性:{{SVGElement("animateMotion")}} + +## 总体注释 + +| 值 | `default` | +| -------- | --------- | +| 默认值 | `default` | +| 可动画的 | 没有 | + +## 规范 + +{{Specifications}} + +## 也可以看看 + +- [`origin`SMIL 动画规范中的定义](https://www.w3.org/TR/smil-animation/#MotionOriginAttribute) diff --git a/files/zh-cn/web/svg/attribute/overflow/index.html b/files/zh-cn/web/svg/attribute/overflow/index.html deleted file mode 100644 index ae374ae8dde1e1..00000000000000 --- a/files/zh-cn/web/svg/attribute/overflow/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: overflow -slug: Web/SVG/Attribute/overflow -translation_of: Web/SVG/Attribute/overflow ---- -

« SVG Attribute reference home

- -

The overflow attribute has the same parameter values as defined for the {{ cssxref("overflow","CSS overflow property") }}. However, the following additional points apply:

- -
    -
  • The overflow attribute only applies to elements that establish new viewports (see below), {{ SVGElement("pattern") }} elements and {{ SVGElement("marker") }} elements. For all other elements, the property has no effect.
  • -
  • For those elements to which the overflow attribute can apply, if the overflow attribute has the value hidden or scroll, the effect is that a new clipping path in the shape of a rectangle is created. The result is equivalent to defining a {{ SVGElement("clipPath") }} element whose content is a {{ SVGElement("rect") }} element which defines the equivalent rectangle, and then specifying the <uri> of this {{ SVGElement("clipPath") }} element on the {{ SVGAttr("clip-path") }} attribute for the given element.
  • -
  • If the overflow attribute has a value other than hidden or scroll, the property has no effect.
  • -
  • Within SVG content, the value auto is equivalent to the value visible.
  • -
  • When an outermost svg element is embedded inline within HTML, if the overflow attribute has the value hidden or scroll, then the browser will establish an initial clipping path equal to the bounds of the initial viewport; otherwise, the initial clipping path is set according to the CSS clipping rules.
  • -
  • When an outermost svg element is stand-alone, the overflow attribute on the outermost svg element is ignored for the purposes of visual rendering and the initial clipping path is set to the bounds of the initial viewport.
  • -
  • The initial value for overflow as defined in CSS is visible, and this applies also to the root {{ SVGElement("svg") }} element; however, for child elements of an SVG document, SVG's browser style sheet overrides this initial value and sets the overflow attribute on elements that establish new viewports, ‘pattern’ elements and ‘marker’ elements to the value hidden.
  • -
- -

As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see {{ cssxref("overflow","CSS overflow") }} for further information.

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesPresentation attribute
Valuevisible | hidden | scroll | auto | inherit
AnimatableYes
- -

Example

- -

Elements

- -

The following elements can use the overflow attribute

- -
    -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("symbol") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("foreignObject") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("marker") }}
  • -
- -

规范

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

- -

See also

- -
    -
  • {{ cssxref("overflow","CSS overflow") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/overflow/index.md b/files/zh-cn/web/svg/attribute/overflow/index.md new file mode 100644 index 00000000000000..f9265e5c926195 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/overflow/index.md @@ -0,0 +1,50 @@ +--- +title: overflow +slug: Web/SVG/Attribute/overflow +translation_of: Web/SVG/Attribute/overflow +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +The `overflow` attribute has the same parameter values as defined for the {{ cssxref("overflow","CSS overflow property") }}. However, the following additional points apply: + +- The `overflow` attribute only applies to elements that establish new viewports (see below), {{ SVGElement("pattern") }} elements and {{ SVGElement("marker") }} elements. For all other elements, the property has no effect. +- For those elements to which the `overflow` attribute can apply, if the `overflow` attribute has the value `hidden` or `scroll`, the effect is that a new clipping path in the shape of a rectangle is created. The result is equivalent to defining a {{ SVGElement("clipPath") }} element whose content is a {{ SVGElement("rect") }} element which defines the equivalent rectangle, and then specifying the \ of this {{ SVGElement("clipPath") }} element on the {{ SVGAttr("clip-path") }} attribute for the given element. +- If the `overflow` attribute has a value other than `hidden` or `scroll`, the property has no effect. +- Within SVG content, the value `auto` is equivalent to the value `visible`. +- When an outermost svg element is embedded inline within HTML, if the `overflow` attribute has the value `hidden` or `scroll`, then the browser will establish an initial clipping path equal to the bounds of the initial viewport; otherwise, the initial clipping path is set according to the CSS clipping rules. +- When an outermost svg element is stand-alone, the `overflow` attribute on the outermost svg element is ignored for the purposes of visual rendering and the initial clipping path is set to the bounds of the initial viewport. +- The initial value for `overflow` as defined in CSS is `visible`, and this applies also to the root {{ SVGElement("svg") }} element; however, for child elements of an SVG document, SVG's browser style sheet overrides this initial value and sets the `overflow` attribute on elements that establish new viewports, ‘pattern’ elements and ‘marker’ elements to the value `hidden`. + +As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see {{ cssxref("overflow","CSS overflow") }} for further information. + +## Usage context + +| Categories | Presentation attribute | +| ---------- | ---------------------------------------------- | +| Value | visible \| hidden \| scroll \| auto \| inherit | +| Animatable | Yes | + +## Example + +## Elements + +The following elements can use the `overflow` attribute + +- {{ SVGElement("svg") }} +- {{ SVGElement("symbol") }} +- {{ SVGElement("image") }} +- {{ SVGElement("foreignObject") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("marker") }} + +## 规范 + +{{Specifications}} + +## Browser compatibility + +{{Compat}} + +## See also + +- {{ cssxref("overflow","CSS overflow") }} diff --git a/files/zh-cn/web/svg/attribute/pathlength/index.html b/files/zh-cn/web/svg/attribute/pathlength/index.html deleted file mode 100644 index 172b3da86b4aa2..00000000000000 --- a/files/zh-cn/web/svg/attribute/pathlength/index.html +++ /dev/null @@ -1,199 +0,0 @@ ---- -title: pathLength -slug: Web/SVG/Attribute/pathLength -translation_of: Web/SVG/Attribute/pathLength ---- -
-

{{SVGRef}}

- -

The pathLength attribute lets authors specify a total length for the path, in user units. This value is then used to calibrate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio pathLength/(computed value of path length).

- -

This can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. Basically, all computations that require the length of the path. {{SVGAttr('stroke-dasharray')}}, for example, will assume the start of the path being 0 and the end point the value defined in the pathLength attribute.

- -

Seven elements are using this attribute: {{SVGElement('circle')}}, {{SVGElement('ellipse')}}, {{SVGElement('line')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, and {{SVGElement('rect')}}

-
- -
- - -
<svg viewBox="0 0 100 60" xmlns="http://www.w3.org/2000/svg">
-  <style>
-  path {
-    fill: none;
-    stroke: black;
-    stroke-width: 2;
-    stroke-dasharray: 10;
-  }
-  </style>
-
-  <!-- No pathLength, the real length of the path is used. In that case, 100 user units -->
-  <path d="M 0,10 h100"/>
-
-  <!-- compute everything like if the path length was 90 user units long -->
-  <path d="M 0,20 h100" pathLength="90"/>
-
-  <!-- compute everything like if the path length was 50 user units long -->
-  <path d="M 0,30 h100" pathLength="50"/>
-
-  <!-- compute everything like if the path length was 30 user units long -->
-  <path d="M 0,40 h100" pathLength="30"/>
-
-  <!-- compute everything like if the path length was 10 user units long -->
-  <path d="M 0,50 h100" pathLength="10"/>
-</svg>
- -

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

-
- -

circle

- -

For {{SVGElement('circle')}}, pathLength lets authors specify a total length for the circle, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

ellipse

- -

For {{SVGElement('ellipse')}}, pathLength lets authors specify a total length for the ellipse, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

line

- -

For {{SVGElement('line')}}, pathLength lets authors specify a total length for the line, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

path

- -

For {{SVGElement('path')}}, pathLength lets authors specify a total length for the path, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

polygon

- -

For {{SVGElement('polygon')}}, pathLength lets authors specify a total length for the shape, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

polyline

- -

For {{SVGElement('polyline')}}, pathLength lets authors specify a total length for the shape, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

rect

- -

For {{SVGElement('circle')}}, pathLength lets authors specify a total length for the rectangle, in user units.

- - - - - - - - - - - - - - - - -
Value<number>
Default valuenone
AnimatableYes
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/pathlength/index.md b/files/zh-cn/web/svg/attribute/pathlength/index.md new file mode 100644 index 00000000000000..4a5a7afc279a4c --- /dev/null +++ b/files/zh-cn/web/svg/attribute/pathlength/index.md @@ -0,0 +1,115 @@ +--- +title: pathLength +slug: Web/SVG/Attribute/pathLength +translation_of: Web/SVG/Attribute/pathLength +--- +{{SVGRef}} + +The **`pathLength`** attribute lets authors specify a total length for the path, in user units. This value is then used to calibrate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio `pathLength`/(_computed value of path length_). + +This can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. Basically, all computations that require the length of the path. {{SVGAttr('stroke-dasharray')}}, for example, will assume the start of the path being 0 and the end point the value defined in the `pathLength` attribute. + +Seven elements are using this attribute: {{SVGElement('circle')}}, {{SVGElement('ellipse')}}, {{SVGElement('line')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, and {{SVGElement('rect')}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## circle + +For {{SVGElement('circle')}}, `pathLength` lets authors specify a total length for the circle, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## ellipse + +For {{SVGElement('ellipse')}}, `pathLength` lets authors specify a total length for the ellipse, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## line + +For {{SVGElement('line')}}, `pathLength` lets authors specify a total length for the line, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## path + +For {{SVGElement('path')}}, `pathLength` lets authors specify a total length for the path, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## polygon + +For {{SVGElement('polygon')}}, `pathLength` lets authors specify a total length for the shape, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## polyline + +For {{SVGElement('polyline')}}, `pathLength` lets authors specify a total length for the shape, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## rect + +For {{SVGElement('circle')}}, `pathLength` lets authors specify a total length for the rectangle, in user units. + +| Value | **[](/docs/Web/SVG/Content_type#Number)** | +| ------------- | ------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/patternunits/index.html b/files/zh-cn/web/svg/attribute/patternunits/index.html deleted file mode 100644 index f3e108142e4a5f..00000000000000 --- a/files/zh-cn/web/svg/attribute/patternunits/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: patternUnits -slug: Web/SVG/Attribute/patternUnits -translation_of: Web/SVG/Attribute/patternUnits ---- -
{{SVGRef}}
- -

The patternUnits attribute indicates which coordinate system to use for the geometry properties of the {{ SVGElement("pattern") }} element.

- -

Only one element is using this attribute: {{SVGElement('pattern')}}

- -
- - -
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
-  <!-- All geometry properties are relative to the current user space -->
-  <pattern id="p1" x="12.5" y="12.5" width="25" height="25"
-           patternUnits="userSpaceOnUse">
-    <circle cx="10" cy="10" r="10" />
-  </pattern>
-
-  <!-- All geometry properties are relative to the target bounding box -->
-  <pattern id="p2" x=".125" y=".125" width=".25" height=".25"
-           patternUnits="objectBoundingBox">
-    <circle cx="10" cy="10" r="10" />
-  </pattern>
-
-  <!-- Left square with user space tiles -->
-  <rect x="10"  y="10" width="80" height="80"
-        fill="url(#p1)" />
-
-  <!-- Right square with bounding box tiles -->
-  <rect x="110" y="10" width="80" height="80"
-        fill="url(#p2)" />
-</svg>
- -

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

-
- -

pattern

- -

For {{SVGElement('pattern')}}, patternUnits defines the coordinate system in use for the geometry properties ({{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} and {{ SVGAttr("height") }}) of the element.

- - - - - - - - - - - - - - - - -
ValueuserSpaceOnUse | objectBoundingBox
Default valueobjectBoundingBox
AnimatableYes
- -
-
userSpaceOnUse
-
This value indicates that all coordinates for the geometry preoperties refer to the user coordinate system as defined when the pattern was applied.
-
objectBoundingBox
-
This value indicates that all coordinates for the geometry properties represent fractions or percentages of the bounding box of the element to which the mask is applied. A bounding box could be considered the same as if the content of the {{ SVGElement("mask") }} were bound to a "0 0 1 1" {{ SVGAttr("viewbox") }}.
-
- -

Specifications

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/patternunits/index.md b/files/zh-cn/web/svg/attribute/patternunits/index.md new file mode 100644 index 00000000000000..99a402cf6cc5ea --- /dev/null +++ b/files/zh-cn/web/svg/attribute/patternunits/index.md @@ -0,0 +1,60 @@ +--- +title: patternUnits +slug: Web/SVG/Attribute/patternUnits +translation_of: Web/SVG/Attribute/patternUnits +--- +{{SVGRef}} + +The **`patternUnits`** attribute indicates which coordinate system to use for the geometry properties of the {{ SVGElement("pattern") }} element. + +Only one element is using this attribute: {{SVGElement('pattern')}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## pattern + +For {{SVGElement('pattern')}}, `patternUnits` defines the coordinate system in use for the geometry properties ({{ SVGAttr("x") }}, {{ SVGAttr("y") }}, {{ SVGAttr("width") }} and {{ SVGAttr("height") }}) of the element. + +| Value | `userSpaceOnUse` \| `objectBoundingBox` | +| ------------- | --------------------------------------- | +| Default value | `objectBoundingBox` | +| Animatable | Yes | + +- userSpaceOnUse + - : This value indicates that all coordinates for the geometry preoperties refer to the user coordinate system as defined when the pattern was applied. +- objectBoundingBox + - : This value indicates that all coordinates for the geometry properties represent fractions or percentages of the bounding box of the element to which the mask is applied. A bounding box could be considered the same as if the content of the {{ SVGElement("mask") }} were bound to a "`0 0 1 1`" {{ SVGAttr("viewbox") }}. + +## Specifications + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/pointer-events/index.html b/files/zh-cn/web/svg/attribute/pointer-events/index.html deleted file mode 100644 index 4c9307b643faaa..00000000000000 --- a/files/zh-cn/web/svg/attribute/pointer-events/index.html +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: pointer-events -slug: Web/SVG/Attribute/pointer-events -translation_of: Web/SVG/Attribute/pointer-events ---- -
{{SVGRef}}
- -

pointer-events 属性是一个展示属性,用于定义元素是否或何时可能是鼠标事件的目标元素。

- -

Note: 作为一个展示属性, {{cssxref('pointer-events')}} 可以被当做 CSS 属性使用。

- -
- - -
<svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg">
-  <!--
-  Circle 元素将始终拦截鼠标事件。
-  为了改变较底部的的 rect 元素的颜色,
-  你需要点击 rect 元素在圆外的部分
-  -->
-  <rect x="0" y="0" height="10" width="10" fill="black" />
-  <circle cx="5" cy="5" r="4" fill="white"
-          pointer-events="visiblePoint" />
-
-  <!--
-  下面的 circle 元素将永远不会获取到鼠标事件,
-  当你点击 circle 元素或者点击 rect 元素时,
-  rect 元素都会改变颜色
-  -->
-  <rect x="10" y="0" height="10" width="10" fill="black" />
-  <circle cx="15" cy="5" r="4" fill="white"
-          pointer-events="none" />
-</svg>
- -
window.addEventListener('mouseup', (e) => {
-  // 在 #000000 和 #FFFFFF 之间随机选取一个颜色
-  const color = Math.round(Math.random() * 0xFFFFFF)
-
-  // 将 color 变量的值按照 CSS 的要求进行格式化
-  const fill = '#' + color.toString(16).padStart(6,'0')
-
-  // 将 color 变量设置的颜色应用到实际点击的元素上
-  e.target.style.fill = fill
-})
- -

{{EmbedLiveSample('topExample', '100%', 150)}}

-
- -

作为一个展示属性,他可以被很多元素使用,但和它紧密相关的只有下面的 23 个元素: {{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('defs')}}, {{SVGElement('ellipse')}}, {{SVGElement('foreignObject')}}, {{SVGElement('g')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('switch')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tspan')}}, {{SVGElement('use')}}

- -

用法

- - - - - - - - - - - - - - - - -
bounding-box | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | none
默认值visiblePainted
是否可动画Yes
- -

为了详细了解每个可能的值,请参考 CSS 文档 {{cssxref('pointer-events')}}.

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/pointer-events/index.md b/files/zh-cn/web/svg/attribute/pointer-events/index.md new file mode 100644 index 00000000000000..2b13527466a490 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/pointer-events/index.md @@ -0,0 +1,72 @@ +--- +title: pointer-events +slug: Web/SVG/Attribute/pointer-events +translation_of: Web/SVG/Attribute/pointer-events +--- +{{SVGRef}} + +pointer-events 属性是一个展示属性,用于定义元素是否或何时可能是鼠标事件的目标元素。 + +**Note:** 作为一个展示属性, {{cssxref('pointer-events')}} 可以被当做 CSS 属性使用。 + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + +``` + +```js +window.addEventListener('mouseup', (e) => { + // 在 #000000 和 #FFFFFF 之间随机选取一个颜色 + const color = Math.round(Math.random() * 0xFFFFFF) + + // 将 color 变量的值按照 CSS 的要求进行格式化 + const fill = '#' + color.toString(16).padStart(6,'0') + + // 将 color 变量设置的颜色应用到实际点击的元素上 + e.target.style.fill = fill +}) +``` + +{{EmbedLiveSample('示例', '100%', 150)}} + +作为一个展示属性,他可以被很多元素使用,但和它紧密相关的只有下面的 23 个元素: {{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('defs')}}, {{SVGElement('ellipse')}}, {{SVGElement('foreignObject')}}, {{SVGElement('g')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('marker')}}, {{SVGElement('mask')}}, {{SVGElement('path')}}, {{SVGElement('pattern')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('svg')}}, {{SVGElement('switch')}}, {{SVGElement('symbol')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tspan')}}, {{SVGElement('use')}} + +## 用法 + +| 值 | `bounding-box` \| `visiblePainted` \| `visibleFill` \| `visibleStroke` \| `visible` \| `painted` \| `fill` \| `stroke` \| `all` \| `none` | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| 默认值 | `visiblePainted` | +| 是否可动画 | Yes | + +_为了详细了解每个可能的值,请参考 CSS 文档 {{cssxref('pointer-events')}}._ + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/points/index.html b/files/zh-cn/web/svg/attribute/points/index.html deleted file mode 100644 index 813832cf0ef7eb..00000000000000 --- a/files/zh-cn/web/svg/attribute/points/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: points -slug: Web/SVG/Attribute/points -tags: - - SVG - - SVG 属性 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/points ---- -

« SVG 属性参考主页

- -

points属性定义了用来画一个{{ SVGElement("polyline") }}元素或画一个 SVGElement("polygon") }}元素的点的数列。

- -

每个点用用户坐标系统中的一个 X 坐标和 Y 坐标定义。用逗号分开每个点的 X 和 Y 坐标标记是一个常用实践(但是并非必要),使用空间标注每个点。

- -

用法

- - - - - - - - - - - - - - - - -
类别
<list-of-points>
可变性Yes
- -

示例

- -
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
-  <polygon points="100,10 250,150 200,110"
-           style="fill:lime;stroke:purple;stroke-width:1" />
-</svg>
-
- -

元素

- -

以下元素可以使用points属性:

- -
    -
  • {{ SVGElement("polyline") }}
  • -
  • {{ SVGElement("polygon") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/points/index.md b/files/zh-cn/web/svg/attribute/points/index.md new file mode 100644 index 00000000000000..d16e14674f4cdb --- /dev/null +++ b/files/zh-cn/web/svg/attribute/points/index.md @@ -0,0 +1,42 @@ +--- +title: points +slug: Web/SVG/Attribute/points +tags: + - SVG + - SVG 属性 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/points +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`points`属性定义了用来画一个{{ SVGElement("polyline") }}元素或画一个 SVGElement("polygon") }}元素的点的数列。 + +每个点用用户坐标系统中的一个 X 坐标和 Y 坐标定义。用逗号分开每个点的 X 和 Y 坐标标记是一个常用实践(但是并非必要),使用空间标注每个点。 + +## 用法 + +| 类别 | 无 | +| ------ | ---------------- | +| 值 | | +| 可变性 | Yes | + +## 示例 + +```xml + + + +``` + +## 元素 + +以下元素可以使用`points`属性: + +- {{ SVGElement("polyline") }} +- {{ SVGElement("polygon") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/presentation/index.html b/files/zh-cn/web/svg/attribute/presentation/index.html deleted file mode 100644 index b8a3b43bd7fde7..00000000000000 --- a/files/zh-cn/web/svg/attribute/presentation/index.html +++ /dev/null @@ -1,274 +0,0 @@ ---- -title: SVG Presentation Attributes -slug: Web/SVG/Attribute/Presentation -translation_of: Web/SVG/Attribute/Presentation ---- -

SVG 表现属性是能够被用在 SVG 元素属性上的 CSS 属性。

- - - -

Attributes

- -
-
{{SVGAttr('alignment-baseline')}}
-
It specifies how an object is aligned along the font baseline with respect to its parent.
- Value: auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical|inherit; Animatable: Yes
-
{{SVGAttr('baseline-shift')}}
-
It allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element.
- Value: auto|baseline|super|sub|<percentage>|<length>|inherit; Animatable: Yes
-
{{SVGAttr('clip')}} {{deprecated_inline('css')}}
-
It defines what portion of an element is visible.
- Value: auto|{{cssxref("shape")}}|inherit; Animatable: Yes
-
{{SVGAttr('clip-path')}}
-
It binds the element it is applied to with a given {{SVGElement('clipPath')}} element.
- Value: none|<FuncIRI>|inherit; Animatable: Yes
-
{{SVGAttr('clip-rule')}}
-
It indicates how to determine what side of a path is inside a shape in order to know how a {{SVGElement('clipPath')}} should clip its target.
- Value: nonezero|evenodd|inherit; Animatable: Yes
-
{{SVGAttr('color')}}
-
It provides a potential indirect value (currentColor) for the fill, stroke, stop-color, flood-color and lighting-color presentation attributes.
- Value: <color>|inherit; Animatable: Yes
-
{{SVGAttr('color-interpolation')}}
-
It specifies the color space for gradient interpolations, color animations, and alpha compositing.
- Value: auto|sRGB|linearRGB|inherit; Animatable: Yes
-
{{SVGAttr('color-interpolation-filters')}}
-
It specifies the color space for imaging operations performed via filter effects.
- Value: auto|sRGB|linearRGB|inherit; Animatable: Yes
-
{{SVGAttr('color-profile')}} {{deprecated_inline('svg2')}}
-
It defines which color profile a raster image included through the {{SVGElement('image')}} element should use.
- Value: auto|sRGB|linearRGB|<name>|<IRI>|inherit; Animatable: Yes
-
{{SVGAttr('color-rendering')}}
-
It provides a hint to the browser about how to optimize its color interpolation and compositing operations.
- Value: auto|optimizeSpeed|optimizeQuality|inherit; Animatable: Yes
-
{{SVGAttr('cursor')}}
-
It specifies the mouse cursor displayed when the mouse pointer is over an element.
- Value: <FuncIRI>|<keywords>|inherit; Animatable: Yes
-
{{SVGAttr('direction')}}
-
It specifies the base writing direction of text.
- Value: ltr|rtl|inherit; Animatable: Yes
-
{{SVGAttr('display')}}
-
It allows to control the rendering of graphical or container elements.
- Value: see css {{cssxref('display')}}; Animatable: Yes
-
{{SVGAttr('dominant-baseline')}}
-
It defines the baseline used to align the box’s text and inline-level contents.
- Value: auto|text-bottom|alphabetic|ideographic|middle|central| mathematical|hanging|text-top; Animatable: Yes
-
{{SVGAttr('enable-background')}} {{deprecated_inline('svg2')}}
-
It tells the browser how to manage the accumulation of the background image.
- Value: accumulate|new|inherit; Animatable: No
-
{{SVGAttr('fill')}}
-
It defines the color of the inside of the graphical element it applies to.
- Value: <paint>; Animatable: Yes
-
{{SVGAttr('fill-opacity')}}
-
It specifies the opacity of the color or the content the current object is filled with.
- Value: <number>|<percentage>; Animatable: Yes
-
{{SVGAttr('fill-rule')}}
-
It indicates how to determine what side of a path is inside a shape.
- Value: nonzero|evenodd|inherit; Animatable: Yes
-
{{SVGAttr('filter')}}
-
It defines the filter effects defined by the {{SVGElement('filter')}} element that shall be applied to its element.
- Value: <FuncIRI>|none|inherit; Animatable: Yes
-
{{SVGAttr('flood-color')}}
-
It indicates what color to use to flood the current filter primitive subregion defined through the {{SVGElement('feFlood')}} or {{SVGElement('feDropShadow')}} element.
- Value: <color>; Animatable: Yes
-
{{SVGAttr('flood-opacity')}}
-
It indicates the opacity value to use across the current filter primitive subregion defined through the {{SVGElement('feFlood')}} or {{SVGElement('feDropShadow')}} element.
- Value: <number>|<percentage>; Animatable: Yes
-
{{SVGAttr('font-family')}}
-
It indicates which font family will be used to render the text of the element.
- Value: see css {{cssxref('font-family')}}; Animatable: Yes
-
{{SVGAttr('font-size')}}
-
It specifies the size of the font.
- Value: see css {{cssxref('font-size')}}; Animatable: Yes
-
{{SVGAttr('font-size-adjust')}}
-
It specifies that the font size should be chosen based on the height of lowercase letters rather than the height of capital letters.
- Value: <number>|none|inherit; Animatable: Yes
-
{{SVGAttr('font-stretch')}}
-
It selects a normal, condensed, or expanded face from a font.
- Value: see css {{cssxref('font-stretch')}}; Animatable: Yes
-
{{SVGAttr('font-style')}}
-
It specifies whether a font should be styled with a normal, italic, or oblique face from its {{SVGAttr('font-family')}}.
- Value: normal|italic|oblique; Animatable: Yes
-
{{SVGAttr('font-variant')}}
-
It specifies whether a font should be used with some of their variation such as small caps or ligatures.
- Value: see css {{cssxref('font-variant')}}; Animatable: Yes
-
{{SVGAttr('font-weight')}}
-
It specifies the weight (or boldness) of the font.
- Value: normal|bold|lighter|bolder|100|200|300|400|500|600|700|800|900; Animatable: Yes
-
{{SVGAttr('glyph-orientation-horizontal')}} {{deprecated_inline('svg2')}}
-
It controls glyph orientation when the inline-progression-direction is horizontal.
- Value: <angle>|inherit; Animatable: No
-
{{SVGAttr('glyph-orientation-vertical')}} {{deprecated_inline('svg2')}}
-
It controls glyph orientation when the inline-progression-direction is vertical.
- Value: auto|<angle>|inherit; Animatable: No
-
{{SVGAttr('image-rendering')}}
-
It provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing.
- Value: auto|optimizeQuality|optimizeSpeed; Animatable: Yes
-
{{SVGAttr('kerning')}} {{deprecated_inline('svg2')}}
-
It indicates whether the browser should adjust inter-glyph spacing.
- Value: auto|<length>|inherit; Animatable: Yes
-
{{SVGAttr('letter-spacing')}}
-
It controls spacing between text characters.
- Value: normal|<length>|inherit; Animatable: Yes
-
{{SVGAttr('lighting-color')}}
-
It defines the color of the light source for filter primitives elements {{SVGElement('feDiffuseLighting')}} and {{SVGElement('feSpecularLighting')}}.
- Value: <color>; Animatable: Yes
-
{{SVGAttr('marker-end')}}
-
It defines the arrowhead or polymarker that will be drawn at the final vertex of the given {{SVGElement('path')}} element or basic shape.
- Value: <FuncIRI>|none|inherit; Animatable: Yes
-
{{SVGAttr('marker-mid')}}
-
It defines the arrowhead or polymarker that will be drawn at every vertex other than the first and last vertex of the given {{SVGElement('path')}} element or basic shape.
- Value: <FuncIRI>|none|inherit; Animatable: Yes
-
{{SVGAttr('marker-start')}}
-
It defines the arrowhead or polymarker that will be drawn at the first vertex of the given {{SVGElement('path')}} element or basic shape.
- Value: <FuncIRI>|none|inherit; Animatable: Yes
-
{{SVGAttr('mask')}}
-
It alters the visibility of an element by either masking or clipping the image at specific points.
- Value: see css {{cssxref('mask')}}; Animatable: Yes
-
{{SVGAttr('opacity')}}
-
It specifies the transparency of an object or a group of objects.
- Value: <opacity-value>; Animatable: Yes
-
{{SVGAttr('overflow')}}
-
Specifies whether the content of a block-level element is clipped when it overflows the element's box.
- Value: visible|hidden|scroll|auto|inherit; Animatable: Yes
-
{{SVGAttr('pointer-events')}}
-
Defines whether or when an element may be the target of a mouse event.
- Value: bounding-box|visiblePainted|visibleFil|visibleStroke|visible |painted|fill|stroke|all|none; Animatable: Yes
-
{{SVGAttr('shape-rendering')}}
-
Hints about what tradeoffs to make as the browser renders {{SVGElement('path')}} element or basic shapes.
- Value: auto|optimizeSpeed|crispEdges|geometricPrecision |inherit; Animatable: Yes
-
{{SVGAttr('solid-color')}}
-
-
- Value:; Animatable: -
-
{{SVGAttr('solid-opacity')}}
-
-
- Value:; Animatable: -
-
{{SVGAttr('stop-color')}}
-
Indicates what color to use at that gradient stop.
- Value: currentColor|<color>|<icccolor>|inherit; Animatable: Yes
-
{{SVGAttr('stop-opacity')}}
-
Defines the opacity of a given gradient stop.
- Value: <opacity-value>|inherit; Animatable: Yes
-
{{SVGAttr('stroke')}}
-
Defines the color used to paint the outline of the shape.
- Value: <paint>; Animatable: Yes
-
{{SVGAttr('stroke-dasharray')}}
-
Defines the pattern of dashes and gaps used to paint the outline of the shape.
- Value: none|<dasharray>; Animatable: Yes
-
{{SVGAttr('stroke-dashoffset')}}
-
Defines an offset on the rendering of the associated dash array.
- Value: <percentage>|<length>; Animatable: Yes
-
{{SVGAttr('stroke-linecap')}}
-
Defines the shape to be used at the end of open subpaths when they are stroked.
- Value: butt|round|square; Animatable: Yes
-
{{SVGAttr('stroke-linejoin')}}
-
Defines the shape to be used at the corners of paths when they are stroked.
- Value: arcs|bevel|miter|miter-clip|round; Animatable: Yes
-
{{SVGAttr('stroke-miterlimit')}}
-
Defines a limit on the ratio of the miter length to the {{ SVGAttr("stroke-width") }} used to draw a miter join.
- Value: <number>; Animatable: Yes
-
{{SVGAttr('stroke-opacity')}}
-
Defines the opacity of the stroke of a shape.
- Value: <opacity-value>|<percentage>; Animatable: Yes
-
{{SVGAttr('stroke-width')}}
-
Defines the width of the stroke to be applied to the shape.
- Value: <length>|<percentage>; Animatable: Yes
-
{{SVGAttr('text-anchor')}}
-
Defines the vertical alignment a string of text.
- Value: start|middle|end|inherit; Animatable: Yes
-
{{SVGAttr('text-decoration')}}
-
Sets the appearance of decorative lines on text.
- Value: none|underline|overline|line-through|blink|inherit; Animatable: Yes
-
{{SVGAttr('text-rendering')}}
-
Hints about what tradeoffs to make as the browser renders text.
- Value: auto|optimizeSpeed|optimizeLegibility|geometricPrecision|inherit; Animatable: Yes
-
{{SVGAttr('transform')}}
-
Defines a list of transform definitions that are applied to an element and the element's children.
- Value: <transform-list>; Animatable: Yes
-
{{SVGAttr('unicode-bidi')}}
-
-
- Value:; Animatable: -
-
{{SVGAttr('vector-effect')}}
-
Specifies the vector effect to use when drawing an object.
- Value: default|non-scaling-stroke|inherit|<uri>; Animatable: Yes
-
{{SVGAttr('visibility')}}
-
Lets you control the visibility of graphical elements.
- Value: visible|hidden|collapse|inherit; Animatable: Yes
-
{{SVGAttr('word-spacing')}}
-
Specifies spacing behavior between words.
- Value: <length>|inherit; Animatable: Yes
-
{{SVGAttr('writing-mode')}}
-
Specifies whether the initial inline-progression-direction for a {{SVGElement('text')}} element shall be left-to-right, right-to-left, or top-to-bottom.
- Value: lr-tb|rl-tb|tb-rl|lr|rl|tb|inherit; Animatable: Yes
-
- -

Browser compatibility

- - - -

{{Compat("svg.attributes.presentation")}}

diff --git a/files/zh-cn/web/svg/attribute/presentation/index.md b/files/zh-cn/web/svg/attribute/presentation/index.md new file mode 100644 index 00000000000000..b2cc384211ac63 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/presentation/index.md @@ -0,0 +1,266 @@ +--- +title: SVG Presentation Attributes +slug: Web/SVG/Attribute/Presentation +translation_of: Web/SVG/Attribute/Presentation +--- +SVG 表现属性是能够被用在 SVG 元素属性上的 CSS 属性。 + +- [alignment-baseline](#attr-alignment-baseline) +- [baseline-shift](#attr-baseline-shift) +- [clip](#attr-clip) +- [clip-path](#attr-clip-path) +- [clip-rule](#attr-clip-rule) +- [color](#attr-color) +- [color-interpolation](#attr-color-interpolation) +- [color-interpolation-filters](#attr-color-interpolation-filters) +- [color-profile](#attr-color-profile) +- [color-rendering](#attr-color-rendering) +- [cursor](#attr-cursor) +- [direction](#attr-direction) +- [display](#attr-display) +- [dominant-baseline](#attr-dominant-baseline) +- [enable-background](#attr-enable-background) +- [fill](#attr-fill) +- [fill-opacity](#attr-fill-opacity) +- [fill-rule](#attr-fill-rule) +- [filter](#attr-filter) +- [flood-color](#attr-flood-color) +- [flood-opacity](#attr-flood-opacity) +- [font-family](#attr-font-family) +- [font-size](#attr-font-size) +- [font-size-adjust](#attr-font-size-adjust) +- [font-stretch](#attr-font-stretch) +- [font-style](#attr-font-style) +- [font-variant](#attr-font-variant) +- [font-weight](#attr-font-weight) +- [glyph-orientation-horizontal](#attr-glyph-orientation-horizontal) +- [glyph-orientation-vertical](#attr-glyph-orientation-vertical) +- [image-rendering](#attr-image-rendering) +- [kerning](#attr-kerning) +- [letter-spacing](#attr-letter-spacing) +- [lighting-color](#attr-lighting-color) +- [marker-end](#attr-marker-end) +- [marker-mid](#attr-marker-mid) +- [marker-start](#attr-marker-start) +- [mask](#attr-mask) +- [opacity](#attr-opacity) +- [overflow](#attr-overflow) +- [pointer-events](#attr-pointer-events) +- [shape-rendering](#attr-shape-rendering) +- [solid-color](#attr-solid-color) +- [solid-opacity](#attr-solid-opacity) +- [stop-color](#attr-stop-color) +- [stop-opacity](#attr-stop-opacity) +- [stroke](#attr-stroke) +- [stroke-dasharray](#attr-stroke-dasharray) +- [stroke-dashoffset](#attr-stroke-dashoffset) +- [stroke-linecap](#attr-stroke-linecap) +- [stroke-linejoin](#attr-stroke-linejoin) +- [stroke-miterlimit](#attr-stroke-miterlimit) +- [stroke-opacity](#attr-stroke-opacity) +- [stroke-width](#attr-stroke-width) +- [text-anchor](#attr-text-anchor) +- [text-decoration](#attr-text-decoration) +- [text-rendering](#attr-text-rendering) +- [transform](#attr-transform) +- [unicode-bidi](#attr-unicode-bidi) +- [vector-effect](#attr-vector-effect) +- [visibility](#attr-visibility) +- [word-spacing](#attr-word-spacing) +- [writing-mode](#attr-writing-mode) + +## Attributes + +- {{SVGAttr('alignment-baseline')}} + - : It specifies how an object is aligned along the font baseline with respect to its parent. + _Value_: **`auto`**|`baseline`|`before-edge`|`text-before-edge`|`middle`|`central`|`after-edge`|`text-after-edge`|`ideographic`|`alphabetic`|`hanging`|`mathematical`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('baseline-shift')}} + - : It allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element. + _Value_: **`auto`**|`baseline`|`super`|`sub`|[\](/docs/Web/SVG/Content_type#Percentage)|[\](/docs/Web/SVG/Content_type#Length)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('clip')}} {{deprecated_inline('css')}} + - : It defines what portion of an element is visible. + _Value_: **`auto`**|{{cssxref("shape")}}|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('clip-path')}} + - : It binds the element it is applied to with a given {{SVGElement('clipPath')}} element. + _Value_: **`none`**|[\](/docs/Web/SVG/Content_type#FuncIRI)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('clip-rule')}} + - : It indicates how to determine what side of a path is inside a shape in order to know how a {{SVGElement('clipPath')}} should clip its target. + _Value_: **`nonezero`**|`evenodd`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('color')}} + - : It provides a potential indirect value (`currentColor`) for the `fill`, `stroke`, `stop-color`, `flood-color` and `lighting-color` presentation attributes. + _Value_: [\](/docs/Web/SVG/Content_type#Color)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('color-interpolation')}} + - : It specifies the color space for gradient interpolations, color animations, and alpha compositing. + _Value_: `auto`|**`sRGB`**|`linearRGB`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('color-interpolation-filters')}} + - : It specifies the color space for imaging operations performed via filter effects. + _Value_: `auto`|`sRGB`|**`linearRGB`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('color-profile')}} {{deprecated_inline('svg2')}} + - : It defines which color profile a raster image included through the {{SVGElement('image')}} element should use. + _Value_: `auto`|`sRGB`|`linearRGB`|[\](/docs/Web/SVG/Content_type#Name)|[\](/docs/Web/SVG/Content_type#IRI)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('color-rendering')}} + - : It provides a hint to the browser about how to optimize its color interpolation and compositing operations. + _Value_: **`auto`**|`optimizeSpeed`|`optimizeQuality`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('cursor')}} + - : It specifies the mouse cursor displayed when the mouse pointer is over an element. + _Value_: [\](/docs/Web/SVG/Content_type#FuncIRI)|[\](/docs/Web/CSS/cursor#Values)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('direction')}} + - : It specifies the base writing direction of text. + _Value_: **`ltr`**|`rtl`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('display')}} + - : It allows to control the rendering of graphical or container elements. + _Value_: see css {{cssxref('display')}}; _Animatable_: **Yes** +- {{SVGAttr('dominant-baseline')}} + - : It defines the baseline used to align the box’s text and inline-level contents. + _Value_: `auto`|`text-bottom`|`alphabetic`|`ideographic`|`middle`|`central`| `mathematical`|`hanging`|`text-top`; _Animatable_: **Yes** +- {{SVGAttr('enable-background')}} {{deprecated_inline('svg2')}} + - : It tells the browser how to manage the accumulation of the background image. + _Value_: **`accumulate`**|`new`|`inherit`; _Animatable_: **No** +- {{SVGAttr('fill')}} + - : It defines the color of the inside of the graphical element it applies to. + _Value_: [\](/docs/Web/SVG/Content_type#Paint); _Animatable_: **Yes** +- {{SVGAttr('fill-opacity')}} + - : It specifies the opacity of the color or the content the current object is filled with. + _Value_: [\](/docs/Web/SVG/Content_type#Number)|[\](/docs/Web/SVG/Content_type#Percentage); _Animatable_: **Yes** +- {{SVGAttr('fill-rule')}} + - : It indicates how to determine what side of a path is inside a shape. + _Value_: **`nonzero`**|`evenodd`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('filter')}} + - : It defines the filter effects defined by the {{SVGElement('filter')}} element that shall be applied to its element. + _Value_: [\](/docs/Web/SVG/Content_type#FuncIRI)|**`none`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('flood-color')}} + - : It indicates what color to use to flood the current filter primitive subregion defined through the {{SVGElement('feFlood')}} or {{SVGElement('feDropShadow')}} element. + _Value_: [\](/docs/Web/SVG/Content_type#Color); _Animatable_: **Yes** +- {{SVGAttr('flood-opacity')}} + - : It indicates the opacity value to use across the current filter primitive subregion defined through the {{SVGElement('feFlood')}} or {{SVGElement('feDropShadow')}} element. + _Value_: [\](/docs/Web/SVG/Content_type#Number)|[\](/docs/Web/SVG/Content_type#Percentage); _Animatable_: **Yes** +- {{SVGAttr('font-family')}} + - : It indicates which font family will be used to render the text of the element. + _Value_: see css {{cssxref('font-family')}}; _Animatable_: **Yes** +- {{SVGAttr('font-size')}} + - : It specifies the size of the font. + _Value_: see css {{cssxref('font-size')}}; _Animatable_: **Yes** +- {{SVGAttr('font-size-adjust')}} + - : It specifies that the font size should be chosen based on the height of lowercase letters rather than the height of capital letters. + _Value_: [\](/docs/Web/SVG/Content_type#Number)|**`none`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('font-stretch')}} + - : It selects a normal, condensed, or expanded face from a font. + _Value_: see css {{cssxref('font-stretch')}}; _Animatable_: **Yes** +- {{SVGAttr('font-style')}} + - : It specifies whether a font should be styled with a normal, italic, or oblique face from its {{SVGAttr('font-family')}}. + _Value_: **`normal`**|`italic`|`oblique`; _Animatable_: **Yes** +- {{SVGAttr('font-variant')}} + - : It specifies whether a font should be used with some of their variation such as small caps or ligatures. + _Value_: see css {{cssxref('font-variant')}}; _Animatable_: **Yes** +- {{SVGAttr('font-weight')}} + - : It specifies the weight (or boldness) of the font. + _Value_: **`normal`**|`bold`|`lighter`|`bolder`|`100`|`200`|`300`|`400`|`500`|`600`|`700`|`800`|`900`; _Animatable_: **Yes** +- {{SVGAttr('glyph-orientation-horizontal')}} {{deprecated_inline('svg2')}} + - : It controls glyph orientation when the inline-progression-direction is horizontal. + _Value_: [\](/docs/Web/SVG/Content_type#Angle)|`inherit`; _Animatable_: **No** +- {{SVGAttr('glyph-orientation-vertical')}} {{deprecated_inline('svg2')}} + - : It controls glyph orientation when the inline-progression-direction is vertical. + _Value_: **`auto`**|[\](/docs/Web/SVG/Content_type#Angle)|`inherit`; _Animatable_: **No** +- {{SVGAttr('image-rendering')}} + - : It provides a hint to the browser about how to make speed vs. quality tradeoffs as it performs image processing. + _Value_: **`auto`**|`optimizeQuality`|`optimizeSpeed`; _Animatable_: **Yes** +- {{SVGAttr('kerning')}} {{deprecated_inline('svg2')}} + - : It indicates whether the browser should adjust inter-glyph spacing. + _Value_: **`auto`**|[\](/docs/Web/SVG/Content_type#Length)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('letter-spacing')}} + - : It controls spacing between text characters. + _Value_: **`normal`**|[\](/docs/Web/SVG/Content_type#Length)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('lighting-color')}} + - : It defines the color of the light source for filter primitives elements {{SVGElement('feDiffuseLighting')}} and {{SVGElement('feSpecularLighting')}}. + _Value_: [\](/docs/Web/SVG/Content_type#Color); _Animatable_: **Yes** +- {{SVGAttr('marker-end')}} + - : It defines the arrowhead or polymarker that will be drawn at the final vertex of the given {{SVGElement('path')}} element or basic shape. + _Value_: [\](/docs/Web/SVG/Content_type#FuncIRI)|**`none`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('marker-mid')}} + - : It defines the arrowhead or polymarker that will be drawn at every vertex other than the first and last vertex of the given {{SVGElement('path')}} element or basic shape. + _Value_: [\](/docs/Web/SVG/Content_type#FuncIRI)|**`none`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('marker-start')}} + - : It defines the arrowhead or polymarker that will be drawn at the first vertex of the given {{SVGElement('path')}} element or basic shape. + _Value_: [\](/docs/Web/SVG/Content_type#FuncIRI)|**`none`**|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('mask')}} + - : It alters the visibility of an element by either masking or clipping the image at specific points. + _Value_: see css {{cssxref('mask')}}; _Animatable_: **Yes** +- {{SVGAttr('opacity')}} + - : It specifies the transparency of an object or a group of objects. + _Value_: [\](/docs/Web/SVG/Content_type#Opacity_value); _Animatable_: **Yes** +- {{SVGAttr('overflow')}} + - : Specifies whether the content of a block-level element is clipped when it overflows the element's box. + _Value_: **`visible`**|`hidden|scroll`|`auto`|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('pointer-events')}} + - : Defines whether or when an element may be the target of a mouse event. + _Value_: `bounding-box`|**`visiblePainted`**|`visibleFil`|`visibleStroke`|`visible` |`painted`|`fill`|`stroke`|`all`|`none`; _Animatable_: **Yes** +- {{SVGAttr('shape-rendering')}} + - : Hints about what tradeoffs to make as the browser renders {{SVGElement('path')}} element or basic shapes. + _Value_: **`auto`**|`optimizeSpeed`|`crispEdges`|`geometricPrecision` |`inherit`; _Animatable_: **Yes** +- {{SVGAttr('solid-color')}} + - : - + _Value_:; _Animatable_: **-** +- {{SVGAttr('solid-opacity')}} + - : - + _Value_:; _Animatable_: **-** +- {{SVGAttr('stop-color')}} + - : Indicates what color to use at that gradient stop. + _Value_: `currentColor`|[\](/en/SVG/Content_type#Color)|[\](/en/SVG/Content_type#ICCColor)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('stop-opacity')}} + - : Defines the opacity of a given gradient stop. + _Value_: [\](/en/SVG/Content_type#Opacity_value)|`inherit`; _Animatable_: **Yes** +- {{SVGAttr('stroke')}} + - : Defines the color used to paint the outline of the shape. + _Value_: [\](/docs/Web/SVG/Content_type#Paint); _Animatable_: **Yes** +- {{SVGAttr('stroke-dasharray')}} + - : Defines the pattern of dashes and gaps used to paint the outline of the shape. + _Value_: `none`|``; _Animatable_: **Yes** +- {{SVGAttr('stroke-dashoffset')}} + - : Defines an offset on the rendering of the associated dash array. + _Value_: [\](/en/SVG/Content_type#Percentage)|[\](/en/SVG/Content_type#Length); _Animatable_: **Yes** +- **{{SVGAttr('stroke-linecap')}}** + - : Defines the shape to be used at the end of open subpaths when they are stroked. + _Value_: **`butt`**|`round`|`square`; _Animatable_: **Yes** +- **{{SVGAttr('stroke-linejoin')}}** + - : Defines the shape to be used at the corners of paths when they are stroked. + _Value_: `arcs`|`bevel`|**`miter`**|`miter-clip`|`round`; _Animatable_: **Yes** +- **{{SVGAttr('stroke-miterlimit')}}** + - : Defines a limit on the ratio of the miter length to the {{ SVGAttr("stroke-width") }} used to draw a miter join. + _Value_: [\](/en/SVG/Content_type#Number); _Animatable_: **Yes** +- **{{SVGAttr('stroke-opacity')}}** + - : Defines the opacity of the stroke of a shape. + _Value_: [\](/en/SVG/Content_type#Opacity_value)|[\](/docs/Web/SVG/Content_type#Paint); _Animatable_: **Yes** +- **{{SVGAttr('stroke-width')}}** + - : Defines the width of the stroke to be applied to the shape. + _Value_: [\](/docs/Web/SVG/Content_type#Length)|[\](/docs/Web/SVG/Content_type#Percentage); _Animatable_: **Yes** +- **{{SVGAttr('text-anchor')}}** + - : Defines the vertical alignment a string of text. + _Value_: `start`|`middle`|`end`|**`inherit`**; _Animatable_: **Yes** +- **{{SVGAttr('text-decoration')}}** + - : Sets the appearance of decorative lines on text. + _Value_: `none`|`underline`|`overline`|`line-through`|`blink`|**`inherit`**; _Animatable_: **Yes** +- **{{SVGAttr('text-rendering')}}** + - : Hints about what tradeoffs to make as the browser renders text. + _Value_: **`auto`**|`optimizeSpeed`|`optimizeLegibility`|`geometricPrecision`|`inherit`; _Animatable_: **Yes** +- **{{SVGAttr('transform')}}** + - : Defines a list of transform definitions that are applied to an element and the element's children. + _Value_: [\](/docs/Web/SVG/Content_type#Transform-list); _Animatable_: **Yes** +- **{{SVGAttr('unicode-bidi')}}** + - : - + _Value_:; _Animatable_: **-** +- **{{SVGAttr('vector-effect')}}** + - : Specifies the vector effect to use when drawing an object. + _Value_: `default`|`non-scaling-stroke`|`inherit`|``; _Animatable_: **Yes** +- **{{SVGAttr('visibility')}}** + - : Lets you control the visibility of graphical elements. + _Value_: **`visible`**|`hidden`|`collapse`|`inherit`; _Animatable_: **Yes** +- **{{SVGAttr('word-spacing')}}** + - : Specifies spacing behavior between words. + _Value_: [\](/en/SVG/Content_type#Length)|**`inherit`**; _Animatable_: **Yes** +- **{{SVGAttr('writing-mode')}}** + - : Specifies whether the initial inline-progression-direction for a {{SVGElement('text')}} element shall be left-to-right, right-to-left, or top-to-bottom. + _Value_: **`lr-tb`**|`rl-tb`|`tb-rl`|`lr`|`rl`|`tb`|`inherit`; _Animatable_: **Yes** + +## Browser compatibility + +{{Compat("svg.attributes.presentation")}} diff --git a/files/zh-cn/web/svg/attribute/preservealpha/index.html b/files/zh-cn/web/svg/attribute/preservealpha/index.html deleted file mode 100644 index 1c06311c4df106..00000000000000 --- a/files/zh-cn/web/svg/attribute/preservealpha/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: preserveAlpha -slug: Web/SVG/Attribute/preserveAlpha -translation_of: Web/SVG/Attribute/preserveAlpha ---- -

« SVG 属性参考

- -

preserveAlpha 属性表示{{ SVGElement("feConvolveMatrix") }} 元素怎样处透明度。

- -

取值为 false 表示 feConvolveMatrix 元素将应用在包括透明度通道的所有的通道。这是默认的选项。

- -

取值为 true 表示 feConvolveMatrix 仅应用在颜色通道。

- -

用法

- - - - - - - - - - - - - - - - -
类别None
true | false
可变性Yes
- -

示例

- -

元素

- -

下列元素可以使用 preserveAlpha 属性

- -
    -
  • {{ SVGElement("feConvolveMatrix") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/preservealpha/index.md b/files/zh-cn/web/svg/attribute/preservealpha/index.md new file mode 100644 index 00000000000000..1a3942885f4f53 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/preservealpha/index.md @@ -0,0 +1,31 @@ +--- +title: preserveAlpha +slug: Web/SVG/Attribute/preserveAlpha +translation_of: Web/SVG/Attribute/preserveAlpha +--- +« [SVG 属性参考](/en/SVG/Attribute) + +`preserveAlpha` 属性表示{{ SVGElement("feConvolveMatrix") }} 元素怎样处透明度。 + +取值为 `false` 表示 feConvolveMatrix 元素将应用在包括透明度通道的所有的通道。这是默认的选项。 + +取值为 `true` 表示 feConvolveMatrix 仅应用在颜色通道。 + +## 用法 + +| 类别 | None | +| ------ | ----------------- | +| 值 | `true` \| `false` | +| 可变性 | Yes | + +## 示例 + +## 元素 + +下列元素可以使用 `preserveAlpha` 属性 + +- {{ SVGElement("feConvolveMatrix") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/preserveaspectratio/index.html b/files/zh-cn/web/svg/attribute/preserveaspectratio/index.html deleted file mode 100644 index 25153417b08c10..00000000000000 --- a/files/zh-cn/web/svg/attribute/preserveaspectratio/index.html +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: preserveAspectRatio -slug: Web/SVG/Attribute/preserveAspectRatio -tags: - - SVG - - SVG 属性 - - 需要实例 -translation_of: Web/SVG/Attribute/preserveAspectRatio ---- -

« SVG Attribute reference home

- -

有时候,通常我们使用 {{ SVGAttr("viewBox") }} 属性时,希望图形拉伸占据整个视口。 在其他情况下,为了保持图形的长宽比,必须使用统一的缩放比例。
-
- preserveAspectRatio属性表示是否强制进行统一缩放。
-
- 对于支持该属性的所有元素 (如上所示),除了 {{ SVGElement("image") }} 元素之外,preserveAspectRatio 只适用于在同一元素上为 {{ SVGAttr("viewBox") }} 提供的值。对于这些元素,如果没有提供属性 {{ SVGAttr("viewBox") }} ,则忽略了 preserveAspectRatio。
-
- 对于 {{ SVGElement("image") }} 元素,preserveAspectRatio 指示引用的图像应该如何与参考矩形进行匹配,以及是否应该相对于当前用户坐标系保留参考图像的长宽比

- -

上下文用法

- - - - - - - - - - - - - - - - -
CategoriesNone
Value<align> [<meetOrSlice>]
AnimatableYes
- -
-
<align>
-
<align> 属性值表示是否强制统一缩放,当 SVG 的 viewbox 属性与视图属性宽高比不一致时使用. <align> 属性的值一定是下列的值之一: -
    -
  • none
    - 不会进行强制统一缩放,如果需要,会缩放指定元素的图形内容,使元素的边界完全匹配视图矩形。
    - (注意:如果 <align> 的值是 none ,则 <meetOrSlice> 属性的值将会被忽略。)
  • -
  • xMinYMin - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。
  • -
  • xMidYMin - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。
  • -
  • xMaxYMin - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。
  • -
  • xMinYMid - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。
  • -
  • xMidYMid (默认值) - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。
  • -
  • xMaxYMid - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。
  • -
  • xMinYMax - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。
  • -
  • xMidYMax - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。
  • -
  • xMaxYMax - 强制统一缩放。
    - 将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。
    - 将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。
  • -
-
-
<meetOrSlice>
-
<meetOrSlice> 是可选的,如果提供的话, 与 <align> 间隔一个或多个的空格 ,参数所选值必须是以下值之一: -
    -
  • meet (默认值) - 图形将缩放到: -
      -
    • 宽高比将会被保留
    • -
    • 整个 SVG 的 viewbox 在视图范围内是可见的
    • -
    • 尽可能的放大 SVG 的 viewbox,同时仍然满足其他的条件。
    • -
    - 在这种情况下,如果图形的宽高比和视图窗口不匹配,则某些视图将会超出 viewbox 范围(即 SVG 的 viewbox 视图将会比可视窗口小)。
  • -
  • slice - 图形将缩放到: -
      -
    • 宽高比将会被保留
    • -
    • 整个视图窗口将覆盖 viewbox
    • -
    • SVG 的 viewbox 属性将会被尽可能的缩小,但是仍然符合其他标准。
    • -
    - 在这种情况下,如果 SVG 的 viewbox 宽高比与可视区域不匹配,则 viewbox 的某些区域将会延伸到视图窗口外部(即 SVG 的 viewbox 将会比可视窗口大)。
  • -
-
-
- -

实例

- -

元素

- -

以下元素可使用 preserveAspectRatio 属性

- -
    -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("symbol") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("feImage") }}
  • -
  • {{ SVGElement("marker") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("view") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/preserveaspectratio/index.md b/files/zh-cn/web/svg/attribute/preserveaspectratio/index.md new file mode 100644 index 00000000000000..ae29b4446f0716 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/preserveaspectratio/index.md @@ -0,0 +1,75 @@ +--- +title: preserveAspectRatio +slug: Web/SVG/Attribute/preserveAspectRatio +tags: + - SVG + - SVG 属性 + - 需要实例 +translation_of: Web/SVG/Attribute/preserveAspectRatio +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +有时候,通常我们使用 {{ SVGAttr("viewBox") }} 属性时,希望图形拉伸占据整个视口。 在其他情况下,为了保持图形的长宽比,必须使用统一的缩放比例。 + +`preserveAspectRatio`属性表示是否强制进行统一缩放。 + +对于支持该属性的所有元素 (如上所示),除了 {{ SVGElement("image") }} 元素之外,preserveAspectRatio 只适用于在同一元素上为 {{ SVGAttr("viewBox") }} 提供的值。对于这些元素,如果没有提供属性 {{ SVGAttr("viewBox") }} ,则忽略了 preserveAspectRatio。 + +对于 {{ SVGElement("image") }} 元素,preserveAspectRatio 指示引用的图像应该如何与参考矩形进行匹配,以及是否应该相对于当前用户坐标系保留参考图像的长宽比 + +## 上下文用法 + +| Categories | None | +| ---------- | ----------------------- | +| Value | [] | +| Animatable | Yes | + +- \ + - : `` 属性值表示是否强制统一缩放,当 SVG 的 viewbox 属性与视图属性宽高比不一致时使用。`` 属性的值一定是下列的值之一: + + - **none** 不会进行强制统一缩放,如果需要,会缩放指定元素的图形内容,使元素的边界完全匹配视图矩形。(注意:如果 `` 的值是 `none` ,则 `` 属性的值将会被忽略。) + - **xMinYMin** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。 + - **xMidYMin** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。 + - **xMaxYMin** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值与视图的 Y 的最小值对齐。 + - **xMinYMid** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。 + - **xMidYMid** (默认值) - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。 + - **xMaxYMid** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。将 SVG 元素的 viewbox 属性的 Y 的中点值与视图的 Y 的中点值对齐。 + - **xMinYMax** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值与视图的 X 的最小值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。 + - **xMidYMax** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的中点值与视图的 X 的中点值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。 + - **xMaxYMax** - 强制统一缩放。将 SVG 元素的 viewbox 属性的 X 的最小值 + 元素的宽度与视图的 X 的最大值对齐。将 SVG 元素的 viewbox 属性的 Y 的最小值 + 元素的高度与视图的 Y 的最大值对齐。 +- \ + - : `` 是可选的,如果提供的话, 与 `` 间隔一个或多个的空格 ,参数所选值必须是以下值之一: + + - **meet** (默认值) - 图形将缩放到: + + - 宽高比将会被保留 + - 整个 SVG 的 viewbox 在视图范围内是可见的 + - 尽可能的放大 SVG 的 viewbox,同时仍然满足其他的条件。 + + 在这种情况下,如果图形的宽高比和视图窗口不匹配,则某些视图将会超出 viewbox 范围(即 SVG 的 viewbox 视图将会比可视窗口小)。 + + - **slice** - 图形将缩放到: + + - 宽高比将会被保留 + - 整个视图窗口将覆盖 viewbox + - SVG 的 viewbox 属性将会被尽可能的缩小,但是仍然符合其他标准。 + + 在这种情况下,如果 SVG 的 viewbox 宽高比与可视区域不匹配,则 viewbox 的某些区域将会延伸到视图窗口外部(即 SVG 的 viewbox 将会比可视窗口大)。 + +## 实例 + +## 元素 + +以下元素可使用 `preserveAspectRatio` 属性 + +- {{ SVGElement("svg") }} +- {{ SVGElement("symbol") }} +- {{ SVGElement("image") }} +- {{ SVGElement("feImage") }} +- {{ SVGElement("marker") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("view") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/primitiveunits/index.html b/files/zh-cn/web/svg/attribute/primitiveunits/index.html deleted file mode 100644 index 07e80d13ac6448..00000000000000 --- a/files/zh-cn/web/svg/attribute/primitiveunits/index.html +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: primitiveUnits -slug: Web/SVG/Attribute/primitiveUnits -translation_of: Web/SVG/Attribute/primitiveUnits ---- -

« SVG Attribute reference home

- -

primitiveUnits 属性为过滤器原语和定义过滤器原语子域中的各种各样的长度单位指定坐标系统.

- -

如果 primitiveUnits 属性未指定,那么效果就如同指定值为 userSpaceOnUse 的效果是一样的。

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesNone
ValueuserSpaceOnUse | objectBoundingBox
AnimatableYes
- -
-
userSpaceOnUse
-
当{{ SVGElement("filter") }}元素使用该值的时候,过滤器中定义的任意长度的值都基于当前用户坐标系统 (例如通过{{ SVGAttr("filter") }}属性引用该{{ SVGElement("filter") }}元素的元素所在的用户坐标系统).
-
objectBoundingBox
-
在 filter 中定义的任意长度值表示引用该 filter 的元素的包围盒的分数或百分比。
-
- -

Examples

- -

Elements

- -

下列元素可以使用 primitiveUnits 属性:

- -
    -
  • {{ SVGElement("filter") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/primitiveunits/index.md b/files/zh-cn/web/svg/attribute/primitiveunits/index.md new file mode 100644 index 00000000000000..41fc6fd0dcdcdb --- /dev/null +++ b/files/zh-cn/web/svg/attribute/primitiveunits/index.md @@ -0,0 +1,34 @@ +--- +title: primitiveUnits +slug: Web/SVG/Attribute/primitiveUnits +translation_of: Web/SVG/Attribute/primitiveUnits +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +`primitiveUnits 属性为过滤器原语和定义过滤器原语子域中的各种各样的长度单位指定坐标系统`. + +如果 primitiveUnits 属性未指定,那么效果就如同指定值为 userSpaceOnUse 的效果是一样的。 + +## Usage context + +| Categories | _None_ | +| ---------- | ------------------------------------------- | +| Value | **`userSpaceOnUse`** \| `objectBoundingBox` | +| Animatable | Yes | + +- userSpaceOnUse + - : 当{{ SVGElement("filter") }}元素使用该值的时候,过滤器中定义的任意长度的值都基于当前用户坐标系统 (例如通过{{ SVGAttr("filter") }}属性引用该{{ SVGElement("filter") }}元素的元素所在的用户坐标系统). +- objectBoundingBox + - : 在 filter 中定义的任意长度值表示引用该 filter 的元素的包围盒的分数或百分比。 + +## Examples + +## Elements + +下列元素可以使用 primitiveUnits 属性: + +- {{ SVGElement("filter") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/r/index.html b/files/zh-cn/web/svg/attribute/r/index.html deleted file mode 100644 index c0edbd07206f97..00000000000000 --- a/files/zh-cn/web/svg/attribute/r/index.html +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: r -slug: Web/SVG/Attribute/r -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/r ---- -
{{SVGRef}}
- -

r 属性用来定义圆的半径。

- -

有两个元素在使用该属性:{{SVGElement("circle")}} 和 {{SVGElement("radialGradient")}}

- -
- - -
<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('topExample', '100%', 200)}}

-
- -

- -

对于 {{SVGElement('circle')}},r 用来定义圆的半径以及它的大小。取值小于或等于零,圆将不会被绘制出来。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值0
可变性Yes
- -

注:起始于 SVG2,r 是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。

- -

径向渐变

- -

对于 {{ SVGElement("radialGradient") }},r 用来定义径向渐变终止圆的半径。

- -

渐变将以此绘制出来:100% 渐变停止点会被映射到终止圆的一周上。取值小于或等于零,将会使用最后一个渐变 {{ SVGElement("stop") }} 的颜色和不透明度,导致该区域被绘制为单色。

- - - - - - - - - - - - - - - - -
<length> | <percentage>
默认值50%
可变性Yes
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/r/index.md b/files/zh-cn/web/svg/attribute/r/index.md new file mode 100644 index 00000000000000..0e5d8c73d620c2 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/r/index.md @@ -0,0 +1,72 @@ +--- +title: r +slug: Web/SVG/Attribute/r +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/r +--- +{{SVGRef}} + +**`r`** 属性用来定义圆的半径。 + +有两个元素在使用该属性:{{SVGElement("circle")}} 和 {{SVGElement("radialGradient")}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## 圆 + +对于 {{SVGElement('circle')}},`r` 用来定义圆的半径以及它的大小。取值小于或等于零,圆将不会被绘制出来。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `0` | +| 可变性 | Yes | + +**注:**起始于 SVG2,`r` 是一个几何属性,意味着该属性也可以用作圆的 CSS 属性。 + +## 径向渐变 + +对于 {{ SVGElement("radialGradient") }},`r` 用来定义径向渐变终止圆的半径。 + +渐变将以此绘制出来:**100%** 渐变停止点会被映射到终止圆的一周上。取值小于或等于零,将会使用最后一个渐变 {{ SVGElement("stop") }} 的颜色和不透明度,导致该区域被绘制为单色。 + +| 值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** | +| ------ | -------------------------------------------------------------------------------------------------------------- | +| 默认值 | `50%` | +| 可变性 | Yes | + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/radius/index.html b/files/zh-cn/web/svg/attribute/radius/index.html deleted file mode 100644 index a37953f789a311..00000000000000 --- a/files/zh-cn/web/svg/attribute/radius/index.html +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: radius -slug: Web/SVG/Attribute/radius -tags: - - SVG - - SVG 属性 - - 滤镜 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/radius ---- -

« SVG 属性参考主页

- -

radius属性代表了一个给定{{SVGElement("feMorphology")}}滤镜上的操作。如果提供了两个<number>,则第一个数代表了 x-radius,第二个数代表了 y-radius。如果只提供了一个数字,则值同时用于 x 和 y。值是在{{SVGElement("filter")}} 元素的属性{{SVGAttr("primitiveUnits")}} 确定的坐标系统内。

- -

如果没有指定该属性值,效果等同于指定了一个0值。

- -

用法

- - - - - - - - - - - - - - - - -
类别
<number-optional-number>
可变性Yes
- -

示例

- -

元素

- -

以下元素可以使用radius属性:

- -
    -
  • {{ SVGElement("feMorphology") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/radius/index.md b/files/zh-cn/web/svg/attribute/radius/index.md new file mode 100644 index 00000000000000..1bf1c38d4b2089 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/radius/index.md @@ -0,0 +1,35 @@ +--- +title: radius +slug: Web/SVG/Attribute/radius +tags: + - SVG + - SVG 属性 + - 滤镜 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/radius +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`radius`属性代表了一个给定{{SVGElement("feMorphology")}}滤镜上的操作。如果提供了两个[\](/en/SVG/Content_type#Number),则第一个数代表了 x-radius,第二个数代表了 y-radius。如果只提供了一个数字,则值同时用于 x 和 y。值是在{{SVGElement("filter")}} 元素的属性{{SVGAttr("primitiveUnits")}} 确定的坐标系统内。 + +如果没有指定该属性值,效果等同于指定了一个**0**值。 + +## 用法 + +| 类别 | _无_ | +| ------ | ----------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Number-optional-number) | +| 可变性 | Yes | + +## 示例 + +## 元素 + +以下元素可以使用`radius`属性: + +- {{ SVGElement("feMorphology") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/repeatcount/index.html b/files/zh-cn/web/svg/attribute/repeatcount/index.html deleted file mode 100644 index d41258f5e8c791..00000000000000 --- a/files/zh-cn/web/svg/attribute/repeatcount/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: repeatCount -slug: Web/SVG/Attribute/repeatCount -translation_of: Web/SVG/Attribute/repeatCount ---- -

« SVG 属性参考

- -

这个属性表示动画将发生的次数。

- -

这个属性的值指定了重复的次数。它也可以包括用分数值表示。它的值必须大于 0。

- -

用法解释

- - - - - - - - - - - - - - - - -
类别动画时间属性
Value<number> | "indefinite"
AnimatableNo
- -

{{ page("/en/SVG/Content_type","Number") }}

- -

Example

- -

Elements

- -

The following elements can use the repeatCount attribute

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/repeatcount/index.md b/files/zh-cn/web/svg/attribute/repeatcount/index.md new file mode 100644 index 00000000000000..e4c8c9f92f7294 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/repeatcount/index.md @@ -0,0 +1,31 @@ +--- +title: repeatCount +slug: Web/SVG/Attribute/repeatCount +translation_of: Web/SVG/Attribute/repeatCount +--- +« [SVG 属性参考](/en/SVG/Attribute) + +这个属性表示动画将发生的次数。 + +这个属性的值指定了重复的次数。它也可以包括用分数值表示。它的值必须大于 0。 + +## 用法解释 + +| 类别 | 动画时间属性 | +| ---------- | ------------------------------------------------------- | +| Value | [](/en/SVG/Content_type#Number) \| "indefinite" | +| Animatable | No | + +{{ page("/en/SVG/Content_type","Number") }} + +## Example + +## Elements + +The following elements can use the `repeatCount` attribute + +- [Animation elements](/en/SVG/Element#Animation) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/result/index.html b/files/zh-cn/web/svg/attribute/result/index.html deleted file mode 100644 index aa0d65ed2c7fc3..00000000000000 --- a/files/zh-cn/web/svg/attribute/result/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: result -slug: Web/SVG/Attribute/result -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/result ---- -

« SVG 属性参考主页

- -

属性result定义了滤镜的分配名。如果提供了它,则经过滤镜处理的结果即图形可以再次滤镜处理,在后继滤镜(即另一个{{ SVGElement("filter") }}元素)上通过一个{{ SVGAttr("in") }}属性引用之前的结果。如果没有提供result值,而且如果下一个滤镜也没有提供{{ SVGAttr("in") }}属性值,则输出只可作为下一个滤镜的隐式输入。

- -

用法

- - - - - - - - - - - - - - - - -
类别
<filter-primitive-reference>
可变性Yes
- -

注意<filter-primitive-reference>不是一个 XML ID,换句话说,<filter-primitive-reference>只在给定的{{ SVGElement("filter") }}元素内部有意义,因此只有局部范围。在同一个{{ SVGElement("filter") }}元素内部,同一个<filter-primitive-reference>出现多次也是合法的。如果引用了,<filter-primitive-reference>将使用在给定结果前面、离给定结果最近的滤镜。

- -

元素

- -

下列元素可以使用result属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/result/index.md b/files/zh-cn/web/svg/attribute/result/index.md new file mode 100644 index 00000000000000..a7d6626ab28dfb --- /dev/null +++ b/files/zh-cn/web/svg/attribute/result/index.md @@ -0,0 +1,31 @@ +--- +title: result +slug: Web/SVG/Attribute/result +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/result +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +属性`result`定义了滤镜的分配名。如果提供了它,则经过滤镜处理的结果即图形可以再次滤镜处理,在后继滤镜(即另一个{{ SVGElement("filter") }}元素)上通过一个{{ SVGAttr("in") }}属性引用之前的结果。如果没有提供`result`值,而且如果下一个滤镜也没有提供{{ SVGAttr("in") }}属性值,则输出只可作为下一个滤镜的隐式输入。 + +## 用法 + +| 类别 | 无 | +| ------ | ---------------------------- | +| 值 | | +| 可变性 | Yes | + +注意``不是一个 XML ID,换句话说,``只在给定的{{ SVGElement("filter") }}元素内部有意义,因此只有局部范围。在同一个{{ SVGElement("filter") }}元素内部,同一个``出现多次也是合法的。如果引用了,``将使用在给定结果前面、离给定结果最近的滤镜。 + +## 元素 + +下列元素可以使用`result`属性: + +- [滤镜元素](/en/SVG/Element#FilterPrimitive) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/rx/index.html b/files/zh-cn/web/svg/attribute/rx/index.html deleted file mode 100644 index f8b2a0a689a5c9..00000000000000 --- a/files/zh-cn/web/svg/attribute/rx/index.html +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: rx -slug: Web/SVG/Attribute/rx -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/rx ---- -
{{SVGRef}}
- -

rx 属性用于定义水平轴向的圆角半径尺寸。

- -

{{SVGElement("ellipse")}} 和 {{SVGElement("rect")}} 两个基本图形使用了这个属性。

- -
- -
- -
- - -
<svg viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
-  <ellipse cx="50"  cy="50" rx="0"  ry="25" />
-  <ellipse cx="150" cy="50" rx="25" ry="25" />
-  <ellipse cx="250" cy="50" rx="50" ry="25" />
-
-  <rect x="20"  y="120" width="60" height="60" rx="0"   ry="15"/>
-  <rect x="120" y="120" width="60" height="60" rx="15"  ry="15"/>
-  <rect x="220" y="120" width="60" height="60" rx="150" ry="15"/>
-</svg>
- -

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

-
- -

椭圆

- -

对于 {{SVGElement('ellipse')}},rx 属性定义了水平方向的半径尺寸。如果使用了负值或者零,那么椭圆就不会被绘制。

- - - - - - - - - - - - - - - - -
取值<length> | <percentage> | auto
默认值auto
是否支持动画
- -

注释: 从 SVG2 开始, rx 是一个几何属性,也就是说,这个属性也可以用作椭圆的 CSS 属性。

- -

矩形

- -

对于 {{SVGElement('rect')}},rx 定义了水平方向的圆角尺寸。

- -

rx 属性的实际效果取决于矩形的 {{SVGAttr("ry")}} 属性和宽度:

- -
    -
  • 如果你为 rx 属性指定了正确的值,但是没有定义 {{SVGAttr("ry")}} 属性的值,那么浏览器会让 {{SVGAttr("ry")}} 取 rx 属性被指定的相等的值。(反之亦然)
  • -
  • 如果 rx 和 {{SVGAttr("ry")}} 都没有被正确的赋值,那么浏览器会绘制一个带有直角尖角的矩形。
  • -
  • rx 属性的有效值为矩形宽度的一半(即,如果为 rx 指定的值大于矩形宽度的一半,那么浏览器会视为 rx 的值为矩形宽度的一半)。
  • -
- - - - - - - - - - - - - - - - -
取值<length> | <percentage> | auto
缺省值auto
是否支持动画
- -

注释: 从 SVG2 开始,rx 是一个几何属性,也就是说,这个属性也可以用作矩形(rect)的 CSS 属性。

- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/rx/index.md b/files/zh-cn/web/svg/attribute/rx/index.md new file mode 100644 index 00000000000000..248c7e876356ec --- /dev/null +++ b/files/zh-cn/web/svg/attribute/rx/index.md @@ -0,0 +1,65 @@ +--- +title: rx +slug: Web/SVG/Attribute/rx +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/rx +--- +{{SVGRef}} + +**`rx`** 属性用于定义水平轴向的圆角半径尺寸。 + +{{SVGElement("ellipse")}} 和 {{SVGElement("rect")}} 两个基本图形使用了这个属性。 + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 200)}} + +## 椭圆 + +对于 {{SVGElement('ellipse')}},`rx` 属性定义了水平方向的半径尺寸。如果使用了负值或者零,那么椭圆就不会被绘制。 + +| 取值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** \| `auto` | +| ------------ | ------------------------------------------------------------------------------------------------------------------------ | +| 默认值 | `auto` | +| 是否支持动画 | 是 | + +**注释:** 从 SVG2 开始, `rx` 是一个几何属性,也就是说,这个属性也可以用作椭圆的 CSS 属性。 + +## 矩形 + +对于 {{SVGElement('rect')}},`rx` 定义了水平方向的圆角尺寸。 + +`rx` 属性的实际效果取决于矩形的 {{SVGAttr("ry")}} 属性和宽度: + +- 如果你为 `rx` 属性指定了正确的值,但是没有定义 {{SVGAttr("ry")}} 属性的值,那么浏览器会让 {{SVGAttr("ry")}} 取 `rx` 属性被指定的相等的值。(反之亦然) +- 如果 `rx` 和 {{SVGAttr("ry")}} 都没有被正确的赋值,那么浏览器会绘制一个带有直角尖角的矩形。 +- `rx` 属性的有效值为矩形宽度的一半(即,如果为 `rx` 指定的值大于矩形宽度的一半,那么浏览器会视为 `rx` 的值为矩形宽度的一半)。 + +| 取值 | **[](/docs/Web/SVG/Content_type#Length)** \| **[](/docs/Web/SVG/Content_type#Percentage)** \| `auto` | +| ------------ | ------------------------------------------------------------------------------------------------------------------------ | +| 缺省值 | `auto` | +| 是否支持动画 | 是 | + +**注释:** 从 SVG2 开始,`rx` 是一个几何属性,也就是说,这个属性也可以用作矩形(rect)的 CSS 属性。 + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/scale/index.html b/files/zh-cn/web/svg/attribute/scale/index.html deleted file mode 100644 index 19759f99a69c4f..00000000000000 --- a/files/zh-cn/web/svg/attribute/scale/index.html +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: scale -slug: Web/SVG/Attribute/scale -tags: - - SVG - - SVG 属性 - - 滤镜 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/scale ---- -

« SVG 属性参考主页

- -

属性scale定义了用在{{SVGElement("feDisplacementMap")}}滤镜上的置换缩放因子。它的总值表达在{{SVGElement("filter")}}元素的属性{{SVGAttr("primitiveUnits")}}确定的坐标系统中。

- -

如果这个属性的值是0,则它的操作对源图像没有影响。

- -

如果没有指定这个属性,则效果等同于它被指定了0值。

- -

用法

- - - - - - - - - - - - - - - - -
类别
<number>
可变性Yes
- -

示例

- -

元素

- -

下列元素可以使用scale属性:

- -
    -
  • {{ SVGElement("feDisplacementMap") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/scale/index.md b/files/zh-cn/web/svg/attribute/scale/index.md new file mode 100644 index 00000000000000..5eb6f30e0553cb --- /dev/null +++ b/files/zh-cn/web/svg/attribute/scale/index.md @@ -0,0 +1,37 @@ +--- +title: scale +slug: Web/SVG/Attribute/scale +tags: + - SVG + - SVG 属性 + - 滤镜 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/scale +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +属性`scale`定义了用在{{SVGElement("feDisplacementMap")}}滤镜上的置换缩放因子。它的总值表达在{{SVGElement("filter")}}元素的属性{{SVGAttr("primitiveUnits")}}确定的坐标系统中。 + +如果这个属性的值是**0**,则它的操作对源图像没有影响。 + +如果没有指定这个属性,则效果等同于它被指定了**0**值。 + +## 用法 + +| 类别 | _无_ | +| ------ | --------------------------------------- | +| 值 | [](/en/SVG/Content_type#Number) | +| 可变性 | Yes | + +## 示例 + +## 元素 + +下列元素可以使用`scale`属性: + +- {{ SVGElement("feDisplacementMap") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/seed/index.html b/files/zh-cn/web/svg/attribute/seed/index.html deleted file mode 100644 index 397e81f471f357..00000000000000 --- a/files/zh-cn/web/svg/attribute/seed/index.html +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: seed -slug: Web/SVG/Attribute/seed -tags: - - SVG - - SVG 属性 - - 滤镜 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/seed ---- -

« SVG 属性参考主页

- -

seed属性代表了{{SVGElement("feTurbulence")}}元素生成的伪随机数的开始数字。

- -

如果没有指定这个属性,它等效于指定了一个0值。

- -

用法

- - - - - - - - - - - - - - - - -
类别None
<number>
可变性Yes
- -

示例

- -

元素

- -

以下元素可以使用seed属性:

- -
    -
  • {{ SVGElement("feTurbulence") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/seed/index.md b/files/zh-cn/web/svg/attribute/seed/index.md new file mode 100644 index 00000000000000..46b234e7ea3d2f --- /dev/null +++ b/files/zh-cn/web/svg/attribute/seed/index.md @@ -0,0 +1,35 @@ +--- +title: seed +slug: Web/SVG/Attribute/seed +tags: + - SVG + - SVG 属性 + - 滤镜 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/seed +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`seed`属性代表了{{SVGElement("feTurbulence")}}元素生成的伪随机数的开始数字。 + +如果没有指定这个属性,它等效于指定了一个`0`值。 + +## 用法 + +| 类别 | _None_ | +| ------ | ----------------------------------------------- | +| 值 | [](/zh-CN/docs/SVG/Content_type#Number) | +| 可变性 | Yes | + +## 示例 + +## 元素 + +以下元素可以使用`seed`属性: + +- {{ SVGElement("feTurbulence") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/shape-rendering/index.html b/files/zh-cn/web/svg/attribute/shape-rendering/index.html deleted file mode 100644 index a6e12d1b0a7fcf..00000000000000 --- a/files/zh-cn/web/svg/attribute/shape-rendering/index.html +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: shape-rendering -slug: Web/SVG/Attribute/shape-rendering -tags: - - SVG - - SVG 线条渲染 - - 需要完善 -translation_of: Web/SVG/Attribute/shape-rendering ---- -

« SVG 属性参考主页

- -

指定 SVG 元素{{SVGElement("path")}}的渲染模式。

- -

使用参考

- - - - - - - - - - - - - - - - -
类型外观属性
auto | optimizeSpeed | crispEdges | geometricPrecision | inherit
可运动Yes
- -
-
auto
-
让浏览器自动权衡渲染速度、平滑度、精确度。默认是倾向于精确度而非平滑度和速度。
-
optimizeSpeed
-
偏向渲染速度,浏览器会关闭反锯齿模式。(速度)
-
crispEdges
-
偏向更加清晰锐利的边缘的渲染。浏览器在渲染的时候会关闭反锯齿模式,且会让线条的位置和宽度和显示器边缘对齐。(锐度)
-
geometricPrecision
-
偏向渲染平滑的曲线。(平滑)
-
- -

示例

- -
<svg xmlns="http://www.w3.org/2000/svg"
-  version="1.1" width="100" height="100"
-  shape-rendering="optimizeSpeed"><!-- 这个示例在 Firefox 下看区别更明显 -->
- - - - - - - - -
-

shape-rendering: geometricPrecision:

- -

shape-rendering:geometricPrecision

-
-

shape-rendering: optimizeSpeed

- -

shape-rendering:optimizeSpeed

-
- -

同样,你也可以在 CSS 样式中使用 shape-rendering:

- -
<svg xmlns="http://www.w3.org/2000/svg"
-  version="1.1" width="100" height="100"
-  style="shape-rendering:optimizeSpeed;">
- -

关联元素

- -

下面的元素可以使用这个属性

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/shape-rendering/index.md b/files/zh-cn/web/svg/attribute/shape-rendering/index.md new file mode 100644 index 00000000000000..267275fc01d6f2 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/shape-rendering/index.md @@ -0,0 +1,57 @@ +--- +title: shape-rendering +slug: Web/SVG/Attribute/shape-rendering +tags: + - SVG + - SVG 线条渲染 + - 需要完善 +translation_of: Web/SVG/Attribute/shape-rendering +--- +« [SVG 属性参考主页](/zh-CN/docs/Web/SVG/Attribute) + +指定 SVG 元素{{SVGElement("path")}}的渲染模式。 + +## 使用参考 + +| 类型 | 外观属性 | +| ------ | ------------------------------------------------------------------------ | +| 值 | **auto** \| optimizeSpeed \| crispEdges \| geometricPrecision \| inherit | +| 可运动 | Yes | + +- auto + - : 让浏览器自动权衡渲染速度、平滑度、精确度。默认是倾向于精确度而非平滑度和速度。 +- optimizeSpeed + - : 偏向渲染速度,浏览器会关闭反锯齿模式。(速度) +- crispEdges + - : 偏向更加清晰锐利的边缘的渲染。浏览器在渲染的时候会关闭反锯齿模式,且会让线条的位置和宽度和显示器边缘对齐。(锐度) +- geometricPrecision + - : 偏向渲染平滑的曲线。(平滑) + +## 示例 + +```xml + +``` + +| shape-rendering: geometricPrecision:![shape-rendering:geometricPrecision](http://download.g63.ru/svg/shape-rendering-geometricPrecision.svg) | shape-rendering: optimizeSpeed![shape-rendering:optimizeSpeed](http://download.g63.ru/svg/shape-rendering-optimizeSpeed.svg) | +| -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | + +同样,你也可以在 CSS 样式中使用 shape-rendering: + +```xml + +``` + +## 关联元素 + +下面的元素可以使用这个属性 + +- [Shape elements](/en/SVG/Element#Shape) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stddeviation/index.html b/files/zh-cn/web/svg/attribute/stddeviation/index.html deleted file mode 100644 index 5c666868794646..00000000000000 --- a/files/zh-cn/web/svg/attribute/stddeviation/index.html +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: stdDeviation -slug: Web/SVG/Attribute/stdDeviation -tags: - - Filters - - SVG - - SVG Attribute -translation_of: Web/SVG/Attribute/stdDeviation ---- -

« SVG 属性参考主页

- -

stdDeviation 属性定义了模糊操作的标准差。如果列出两个 <number>,第一个数字表示沿着 x 轴的标准差值,第二个值表示沿着 y 轴的标准差值。如果只出现一个数字,那个值就表示在 x 轴和 y 轴上有着相同的标准差。

- -

负值是不允许的。设为零即禁用了已有滤镜的原本效果(比如,结果是滤镜输入图像)。如果 stdDeviation 在 x 轴和 y 轴上只有一个为 0,那么模糊效果就只会应用于非 0 的那个方向。

- -

如果此属性没被定义,就与标准差值被定义为 0 的效果一样。

- -

用法

- - - - - - - - - - - - - - - - -
类别None
<number-optional-number>
可变性Yes
- -

{{ page("/en-US/docs/SVG/Content_type","Number-optional-number") }}

- -

示例

- -

元素

- -

以下的元素可以使用 stdDeviation 属性

- -
    -
  • {{ SVGElement("feGaussianBlur") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stddeviation/index.md b/files/zh-cn/web/svg/attribute/stddeviation/index.md new file mode 100644 index 00000000000000..70e0ac1cbae50d --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stddeviation/index.md @@ -0,0 +1,37 @@ +--- +title: stdDeviation +slug: Web/SVG/Attribute/stdDeviation +tags: + - Filters + - SVG + - SVG Attribute +translation_of: Web/SVG/Attribute/stdDeviation +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`stdDeviation` 属性定义了模糊操作的标准差。如果列出两个 [\](/zh-CN/docs/SVG/Content_type#Number),第一个数字表示沿着 x 轴的标准差值,第二个值表示沿着 y 轴的标准差值。如果只出现一个数字,那个值就表示在 x 轴和 y 轴上有着相同的标准差。 + +负值是不允许的。设为零即禁用了已有滤镜的原本效果(比如,结果是滤镜输入图像)。如果 `stdDeviation` 在 x 轴和 y 轴上只有一个为 0,那么模糊效果就只会应用于非 0 的那个方向。 + +如果此属性没被定义,就与标准差值被定义为 0 的效果一样。 + +## 用法 + +| 类别 | None | +| ------ | ------------------------------------------------------------------------------- | +| 值 | [](/zh-CN/docs/SVG/Content_type#Number-optional-number) | +| 可变性 | Yes | + +{{ page("/en-US/docs/SVG/Content_type","Number-optional-number") }} + +## 示例 + +## 元素 + +以下的元素可以使用 `stdDeviation` 属性 + +- {{ SVGElement("feGaussianBlur") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/string/index.html b/files/zh-cn/web/svg/attribute/string/index.html deleted file mode 100644 index ef079316a903c5..00000000000000 --- a/files/zh-cn/web/svg/attribute/string/index.html +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: string -slug: Web/SVG/Attribute/string -translation_of: Web/SVG/Attribute/string ---- -
{{SVGRef}}{{deprecated_header("SVG 2")}}
- -

The string attribute is a hint to the user agent, and specifies a list of formats that the font referenced by the parent {{SVGElement("font-face-uri")}} element supports.

- -

Only one element is using this attribute: {{SVGElement("font-face-format")}}

- -

Usage notes

- - - - - - - - - - - - - - - - -
Value<anything>
Default valueNone
AnimatableNo
- -
-
<anything>
-
-

This value specifies a list of formats that are supported by the font referenced by the parent {{SVGElement("font-face-uri")}} element.

- -

The available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg". See the {{cssxref("@font-face/src", "src")}} descriptor of the {{cssxref("@font-face")}} at-rule for more information.

-
-
- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/string/index.md b/files/zh-cn/web/svg/attribute/string/index.md new file mode 100644 index 00000000000000..9ec1c30b8395b6 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/string/index.md @@ -0,0 +1,28 @@ +--- +title: string +slug: Web/SVG/Attribute/string +translation_of: Web/SVG/Attribute/string +--- +{{SVGRef}}{{deprecated_header("SVG 2")}} + +The **`string`** attribute is a hint to the user agent, and specifies a list of formats that the font referenced by the parent {{SVGElement("font-face-uri")}} element supports. + +Only one element is using this attribute: {{SVGElement("font-face-format")}} + +## Usage notes + +| Value | [``](/en-US/docs/Web/SVG/Content_type#Anything) | +| ------------- | --------------------------------------------------------- | +| Default value | _None_ | +| Animatable | No | + +- `` + - : This value specifies a list of formats that are supported by the font referenced by the parent {{SVGElement("font-face-uri")}} element.The available types are: `"woff"`, `"woff2"`, `"truetype"`, `"opentype"`, `"embedded-opentype"`, and `"svg"`. See the {{cssxref("@font-face/src", "src")}} descriptor of the {{cssxref("@font-face")}} at-rule for more information. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/stroke-dasharray/index.html b/files/zh-cn/web/svg/attribute/stroke-dasharray/index.html deleted file mode 100644 index 35892728464550..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-dasharray/index.html +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: stroke-dasharray -slug: Web/SVG/Attribute/stroke-dasharray -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/stroke-dasharray ---- -

« SVG 属性参考主页

- -

属性 stroke-dasharray 可控制用来描边的点划线的图案范式。

- -

作为一个外观属性,它也可以直接用作一个 CSS 样式表内部的属性。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
none | <dasharray> | inherit
可变性Yes
- -
-
<dasharray>
-
它是一个<length><percentage>数列,数与数之间用逗号或者空白隔开,指定短划线和缺口的长度。如果提供了奇数个值,则这个值的数列重复一次,从而变成偶数个值。因此,5,3,2等同于5,3,2,5,3,2
-
- -

示例

- -
<?xml version="1.0"?>
-<svg width="200" height="200" viewPort="0 0 200 300" version="1.1" xmlns="http://www.w3.org/2000/svg">
-
-    <line stroke-dasharray="5, 5"              x1="10" y1="10" x2="190" y2="10" />
-    <line stroke-dasharray="5, 10"             x1="10" y1="30" x2="190" y2="30" />
-    <line stroke-dasharray="10, 5"             x1="10" y1="50" x2="190" y2="50" />
-    <line stroke-dasharray="5, 1"              x1="10" y1="70" x2="190" y2="70" />
-    <line stroke-dasharray="1, 5"              x1="10" y1="90" x2="190" y2="90" />
-    <line stroke-dasharray="0.9"               x1="10" y1="110" x2="190" y2="110" />
-    <line stroke-dasharray="15, 10, 5"         x1="10" y1="130" x2="190" y2="130" />
-    <line stroke-dasharray="15, 10, 5, 10"     x1="10" y1="150" x2="190" y2="150" />
-    <line stroke-dasharray="15, 10, 5, 10, 15" x1="10" y1="170" x2="190" y2="170" />
-    <line stroke-dasharray="5, 5, 1, 5"        x1="10" y1="190" x2="190" y2="190" />
-
-<style><![CDATA[
-line{
-    stroke: black;
-    stroke-width: 2;
-}
-]]></style>
-</svg>
- -

示例输出

- -

{{ EmbedLiveSample('示例','220','220') }}

- -

元素

- -

下列元素可以使用stroke-dasharray 属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-dasharray/index.md b/files/zh-cn/web/svg/attribute/stroke-dasharray/index.md new file mode 100644 index 00000000000000..eba2584afa42ea --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-dasharray/index.md @@ -0,0 +1,65 @@ +--- +title: stroke-dasharray +slug: Web/SVG/Attribute/stroke-dasharray +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/stroke-dasharray +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`属性 stroke-dasharray 可`控制用来描边的点划线的图案范式。 + +作为一个外观属性,它也可以直接用作一个 CSS 样式表内部的属性。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | ---------------------------------- | +| 值 | **none** \| \| inherit | +| 可变性 | Yes | + +- \ + - : 它是一个[\](/en/SVG/Content_type#Length)和[\](/en/SVG/Content_type#Percentage)数列,数与数之间用逗号或者空白隔开,指定短划线和缺口的长度。如果提供了奇数个值,则这个值的数列重复一次,从而变成偶数个值。因此,**5,3,2**等同于**5,3,2,5,3,2**。 + +## 示例 + +```html + + + + + + + + + + + + + + + + +``` + +**示例输出** + +{{ EmbedLiveSample('示例','220','220') }} + +## 元素 + +下列元素可以使用`stroke-dasharray 属性:` + +- [形状元素](/en/SVG/Element#Shape_elements) » +- [文本内容元素](/en/SVG/Element#Text_content_elements) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.html b/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.html deleted file mode 100644 index 51e3893aae22b9..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: stroke-dashoffset -slug: Web/SVG/Attribute/stroke-dashoffset -tags: - - SVG - - SVG 属性 - - 需要兼容性表 - - 需要示例 -translation_of: Web/SVG/Attribute/stroke-dashoffset ---- -

« SVG属性参考主页

- -

stroke-dashoffset 属性指定了 dash 模式到路径开始的距离

- -

如果使用了一个 <百分比> 值, 那么这个值就代表了当前 viewport 的一个百分比。
-
- 值可以取为负值。

- -

使用环境

- - - - - - - - - - - - - - - - - - - - -
类别显示属性
<percentage> | <length> | inherit
初始值1
可动画Yes
- -

示例

- -

元素

- -

以下元素可使用 stroke-dashoffset 属性

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.md b/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.md new file mode 100644 index 00000000000000..0955ad35687fa5 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-dashoffset/index.md @@ -0,0 +1,38 @@ +--- +title: stroke-dashoffset +slug: Web/SVG/Attribute/stroke-dashoffset +tags: + - SVG + - SVG 属性 + - 需要兼容性表 + - 需要示例 +translation_of: Web/SVG/Attribute/stroke-dashoffset +--- +« [SVG](/en/SVG/Attribute)属性参考主页 + +`stroke-dashoffset` 属性指定了 dash 模式到路径开始的距离 + +如果使用了一个 [<百分比>](/en/SVG/Content_type#Percentage) 值, 那么这个值就代表了当前 viewport 的一个百分比。 + +值可以取为负值。 + +## 使用环境 + +| 类别 | 显示属性 | +| ------ | ----------------------------------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Percentage) \| [](/en/SVG/Content_type#Length) \| inherit | +| 初始值 | 1 | +| 可动画 | Yes | + +## 示例 + +## 元素 + +以下元素可使用 stroke-dashoffset 属性 + +- [形状元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-linecap/index.html b/files/zh-cn/web/svg/attribute/stroke-linecap/index.html deleted file mode 100644 index 95c3a7984bba5e..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-linecap/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: stroke-linecap -slug: Web/SVG/Attribute/stroke-linecap -tags: - - SVG - - SVG 属性 -translation_of: Web/SVG/Attribute/stroke-linecap ---- -

« SVG 属性 参照主页

- -

stroke-linecap 属性制定了,在开放子路径被设置描边的情况下,用于开放自路径两端的形状。

- -

作为一个展现属性,它也可以在一个 CSS 样式表内部,作为一个属性直接使用。

- -

使用背景

- - - - - - - - - - - - - - - - -
分类展现属性
属性值butt | round | square | inherit
可动画化
- -

Example

- -
<?xml version="1.0"?>
-<svg width="120" height="120"
-     viewPort="0 0 120 120" version="1.1"
-     xmlns="http://www.w3.org/2000/svg">
-
-    <line stroke-linecap="butt"
-          x1="30" y1="30" x2="30" y2="90"
-          stroke="black" stroke-width="20"/>
-
-    <line stroke-linecap="round"
-          x1="60" y1="30" x2="60" y2="90"
-          stroke="black" stroke-width="20"/>
-
-    <line stroke-linecap="square"
-          x1="90" y1="30" x2="90" y2="90"
-          stroke="black" stroke-width="20"/>
-
-    <path d="M30,30 L30,90 M60,30 L60,90 M90,30 L90,90"
-          stroke="white" />
-</svg>
- -

实时样例

- -

{{ EmbedLiveSample('Example','120','120') }}

- -

元素

- -

以下元素可以使用stroke-linecap 属性

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-linecap/index.md b/files/zh-cn/web/svg/attribute/stroke-linecap/index.md new file mode 100644 index 00000000000000..8dd0f5df7ba0d3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-linecap/index.md @@ -0,0 +1,60 @@ +--- +title: stroke-linecap +slug: Web/SVG/Attribute/stroke-linecap +tags: + - SVG + - SVG 属性 +translation_of: Web/SVG/Attribute/stroke-linecap +--- +« [SVG 属性 参照主页](/zh-CN/docs/Web/SVG/Attribute) + +`stroke-linecap` 属性制定了,在开放子路径被设置描边的情况下,用于开放自路径两端的形状。 + +作为一个展现属性,它也可以在一个 CSS 样式表内部,作为一个属性直接使用。 + +## 使用背景 + +| 分类 | 展现属性 | +| -------- | ---------------------------------- | +| 属性值 | butt \| round \| square \| inherit | +| 可动画化 | 是 | + +## Example + +```html + + + + + + + + + + + +``` + +**实时样例** + +{{ EmbedLiveSample('Example','120','120') }} + +## 元素 + +以下元素可以使用`stroke-linecap` 属性 + +- [图形元素](/zh-CN/docs/Web/SVG/Element#Shape) » +- [文本内容元素](/zh-CN/docs/Web/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-linejoin/index.html b/files/zh-cn/web/svg/attribute/stroke-linejoin/index.html deleted file mode 100644 index 29053578269048..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-linejoin/index.html +++ /dev/null @@ -1,269 +0,0 @@ ---- -title: stroke-linejoin -slug: Web/SVG/Attribute/stroke-linejoin -translation_of: Web/SVG/Attribute/stroke-linejoin ---- -
{{SVGRef}}
- -

stroke-linejoin 属性指明路径的转角处使用的形状或者绘制的基础形状。

- -
备注: 作为显示属性, stroke-linejoin 能被用做 CSS 属性。
- -

作为显示属性,该属性能被应用到任何元素,但只对这 9 种元素有效: {{SVGElement('altGlyph')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tref')}}, {{SVGElement('tspan')}}

- -
- - -
<svg viewBox="0 0 18 12" xmlns="http://www.w3.org/2000/svg">
-  <!--
-  Upper left path:
-  Effect of the "miter" value
-  -->
-  <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none"
-        stroke-linejoin="miter" />
-
-  <!--
-  Center path:
-  Effect of the "round" value
-  -->
-  <path d="M7,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none"
-        stroke-linejoin="round" />
-
-  <!--
-  Upper right path:
-  Effect of the "bevel" value
-  -->
-  <path d="M13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none"
-        stroke-linejoin="bevel" />
-
-  <!--
-  Bottom left path:
-  Effect of the "miter-clip" value
-  with fallback to "miter" if not supported.
-  -->
-  <path d="M3,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none"
-        stroke-linejoin="miter-clip" />
-
-  <!--
-  Bottom right path:
-  Effect of the "arcs" value
-  with fallback to "miter" if not supported.
-  -->
-  <path d="M9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none"
-        stroke-linejoin="arcs" />
-
-
-  <!--
-  the following pink lines highlight the
-  position of the path for each stroke
-  -->
-  <g id="highlight">
-    <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5"
-          stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5"   r="0.05" fill="pink" />
-    <circle cx="3" cy="2"   r="0.05" fill="pink" />
-    <circle cx="5" cy="5.5" r="0.05" fill="pink" />
-  </g>
-  <use xlink:href="#highlight" x="6" />
-  <use xlink:href="#highlight" x="12" />
-  <use xlink:href="#highlight" x="2" y="6" />
-  <use xlink:href="#highlight" x="8" y="6" />
-</svg>
-
- -

{{EmbedLiveSample('topExample', '100%', 400)}}

-
- -

用法

- - - - - - - - - - - - - - - - -
arcs | bevel |miter | miter-clip | round
默认值miter
可动画性Yes
- -

arcs

- -
说明: arcs 来自于 SVG2 但尚未被广泛支持,详情参见 浏览器兼容性
- -

arcs 值指示将使用圆弧拐角来连接路径线段。 通过用与连接点的外边缘具有相同曲率的圆弧在连接点处延伸笔触的外边缘来形成弧形。

- -

示例

- - - -
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg">
-  <!-- Effect of the "arcs" value -->
-  <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3" stroke="black" fill="none"
-        stroke-linejoin="arcs" />
-
-  <!--
-  the following pink lines highlight the
-  position of the path for each stroke
-  -->
-  <g id="p">
-    <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3"
-          stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5" r="0.05" fill="pink" />
-    <circle cx="3" cy="2" r="0.05" fill="pink" />
-    <circle cx="5" cy="5" r="0.05" fill="pink" />
-  </g>
-</svg>
- -

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

- -

bevel

- -

The bevel 用斜角连接路径段。

- -

示例

- - - -
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg">
-  <!-- Effect of the "bevel" value -->
-  <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none"
-        stroke-linejoin="bevel" />
-
-  <!--
-  the following pink lines highlight the
-  position of the path for each stroke
-  -->
-  <g id="p">
-    <path d="M1,5 l2,-3 l2,3"
-          stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5" r="0.05" fill="pink" />
-    <circle cx="3" cy="2" r="0.05" fill="pink" />
-    <circle cx="5" cy="5" r="0.05" fill="pink" />
-  </g>
-</svg>
- -

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

- -

miter

- -

The miter 用尖角连接路径段。 通过在路径段的切线处延伸笔触的外边缘直到它们相交,来形成拐角。

- -

备注: 如果超出了{{SVGAttr('stroke-miterlimit')}},则会退回到 bevel

- -

示例

- - - -
<svg viewBox="0 -1 10 7" xmlns="http://www.w3.org/2000/svg">
-  <!-- Effect of the "miter" value -->
-  <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none"
-        stroke-linejoin="miter" />
-
-  <!-- Effect of the "miter" value on a sharp angle
-       where de default miter limit is exceeded -->
-  <path d="M7,5 l0.75,-3 l0.75,3" stroke="black" fill="none"
-        stroke-linejoin="miter" />
-
-  <!-- the following red dotted line show where
-       the miter value falls back to the bevel value -->
-  <path d="M0,0 h10" stroke="red" stroke-dasharray="0.05"  stroke-width="0.025"/>
-
-  <!-- the following pink lines highlight the position of the path for each stroke -->
-  <g>
-    <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5" r="0.05" fill="pink" />
-    <circle cx="3" cy="2" r="0.05" fill="pink" />
-    <circle cx="5" cy="5" r="0.05" fill="pink" />
-
-    <path d="M7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="7"    cy="5" r="0.05" fill="pink" />
-    <circle cx="7.75" cy="2" r="0.05" fill="pink" />
-    <circle cx="8.5"  cy="5" r="0.05" fill="pink" />
-  </g>
-</svg>
- -

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

- -

miter-clip

- -
说明: miter-clip 来自于 SVG2 但尚未被广泛支持,详情参见 浏览器兼容性
- -

The miter-clip 用尖角连接路径段。 通过在路径段的切线处延伸笔触的外边缘直到它们相交,来形成拐角。

- -

如果超过了{{SVGAttr('stroke-miterlimit')}},则斜切将被裁剪为等于{{SVGAttr('stroke-miterlimit')}}值乘以路径段相交处的笔划宽度的一半的距离。在非常尖锐的连接或动画的情况下,这提供了比 mitt 更好的渲染效果。

- -

示例

- - - -
<svg viewBox="0 -1 10 7" xmlns="http://www.w3.org/2000/svg">
-  <!-- Effect of the "miter-clip" value -->
-  <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none"
-        stroke-linejoin="miter-clip" />
-
-  <!-- Effect of the "miter-clip" value on a sharp angle
-       where de default miter limit is exceeded -->
-  <path d="M7,5 l0.75,-3 l0.75,3" stroke="black" fill="none"
-        stroke-linejoin="miter-clip" />
-
-  <!-- the following red dotted line show where the clip should happen -->
-  <path d="M0,0 h10" stroke="red" stroke-dasharray="0.05"  stroke-width="0.025"/>
-
-  <!-- the following pink lines highlight the position of the path for each stroke -->
-  <g>
-    <path d="M1,5 l2,-3 l2,3" stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5" r="0.05" fill="pink" />
-    <circle cx="3" cy="2" r="0.05" fill="pink" />
-    <circle cx="5" cy="5" r="0.05" fill="pink" />
-
-    <path d="M7,5 l0.75,-3 l0.75,3" stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="7"    cy="5" r="0.05" fill="pink" />
-    <circle cx="7.75" cy="2" r="0.05" fill="pink" />
-    <circle cx="8.5"  cy="5" r="0.05" fill="pink" />
-  </g>
-</svg>
- -

{{EmbedLiveSample('miter-clip', '100%', 200)}}

- -

round

- -

round 使用圆角连接路径片段。

- -

示例

- - - -
<svg viewBox="0 0 6 6" xmlns="http://www.w3.org/2000/svg">
-  <!-- Effect of the "round" value -->
-  <path d="M1,5 l2,-3 l2,3" stroke="black" fill="none"
-        stroke-linejoin="round" />
-
-  <!--
-  the following pink lines highlight the
-  position of the path for each stroke
-  -->
-  <g id="p">
-    <path d="M1,5 l2,-3 l2,3"
-          stroke="pink" fill="none" stroke-width="0.025" />
-    <circle cx="1" cy="5" r="0.05" fill="pink" />
-    <circle cx="3" cy="2" r="0.05" fill="pink" />
-    <circle cx="5" cy="5" r="0.05" fill="pink" />
-  </g>
-</svg>
- -

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

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/stroke-linejoin/index.md b/files/zh-cn/web/svg/attribute/stroke-linejoin/index.md new file mode 100644 index 00000000000000..63ed54089988aa --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-linejoin/index.md @@ -0,0 +1,280 @@ +--- +title: stroke-linejoin +slug: Web/SVG/Attribute/stroke-linejoin +translation_of: Web/SVG/Attribute/stroke-linejoin +--- +{{SVGRef}} + +**`stroke-linejoin`** 属性指明路径的转角处使用的形状或者绘制的基础形状。 + +> **备注:** 作为显示属性, `stroke-linejoin` 能被用做 CSS 属性。 + +作为显示属性,该属性能被应用到任何元素,但只对这 9 种元素有效: {{SVGElement('altGlyph')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('text')}}, {{SVGElement('textPath')}}, {{SVGElement('tref')}}, {{SVGElement('tspan')}} + +## 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('示例', '100%', 400)}} + +## 用法 + +| 值 | `arcs` \| `bevel` \|`miter` \| `miter-clip` \| `round` | +| -------- | ------------------------------------------------------ | +| 默认值 | `miter` | +| 可动画性 | Yes | + +### arcs + +> **备注:** `arcs` 来自于 SVG2 但尚未被广泛支持,详情参见 [浏览器兼容性](#Browser_compatibility) + +`arcs` 值指示将使用圆弧拐角来连接路径线段。 通过用与连接点的外边缘具有相同曲率的圆弧在连接点处延伸笔触的外边缘来形成弧形。 + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + +``` + +{{EmbedLiveSample('arcs', '100%', 200)}} + +### bevel + +The `bevel` 用斜角连接路径段。 + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + +``` + +{{EmbedLiveSample('bevel', '100%', 200)}} + +### miter + +The `miter` 用尖角连接路径段。 通过在路径段的切线处延伸笔触的外边缘直到它们相交,来形成拐角。 + +> **备注:** 如果超出了{{SVGAttr('stroke-miterlimit')}},则会退回到 `bevel`。 + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('miter', '100%', 200)}} + +### miter-clip + +> **备注:** `miter-clip` 来自于 SVG2 但尚未被广泛支持,详情参见 [浏览器兼容性](#Browser_compatibility) + +The `miter-clip` 用尖角连接路径段。 通过在路径段的切线处延伸笔触的外边缘直到它们相交,来形成拐角。 + +如果超过了{{SVGAttr('stroke-miterlimit')}},则斜切将被裁剪为等于{{SVGAttr('stroke-miterlimit')}}值乘以路径段相交处的笔划宽度的一半的距离。在非常尖锐的连接或动画的情况下,这提供了比 `mitt` 更好的渲染效果。 + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('miter-clip', '100%', 200)}} + +### round + +`round` 使用圆角连接路径片段。 + +#### 示例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + +``` + +{{EmbedLiveSample('round', '100%', 200)}} + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.html b/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.html deleted file mode 100644 index 87762ec6475277..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: stroke-miterlimit -slug: Web/SVG/Attribute/stroke-miterlimit -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/stroke-miterlimit ---- -

« SVG 属性参考主页

- -

如果两条线交汇在一起形成一个尖角,而且属性{{ SVGAttr("stroke-linejoin") }}指定了miter,斜接有可能扩展到远远超过出路径轮廓线的线宽。属性stroke-miterlimit 对斜接长度和{{ SVGAttr("stroke-width") }}的比率强加了一个极限。当极限到达时,交汇处由斜接变成倒角。

- -

斜接长度(斜接的外尖角和内夹角之间的距离)与{{ SVGAttr("stroke-width") }}的比率,直接跟两条线之间的角度(θ)有关,用如下方程表示:

- -
miterLength / stroke-width = 1 / sin ( theta / 2 )
-
- -

举个例子,一个极限为 1.414 斜接,θ小于 90 度的把斜接会转换成倒角,一个极限为 4.0 的斜接,θ小于 29 度的斜接会转换成倒角,一个极限为 10.0 的斜接,θ小于大约 11.5 度的斜接会转换成倒角。

- -

用法

- - - - - - - - - - - - - - - - - - - - -
类别外观属性
<miterlimit> | inherit
初始值4
可动性Yes
- -
-
<miterlimit>
-
对斜角长度与{{ SVGAttr("stroke-width") }}的比率的限制。<miterlimit>的值必须是一个大于或等于 1 的<number>
-
- -

示例

- -

元素

- -

下列元素可以使用stroke-miterlimit属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.md b/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.md new file mode 100644 index 00000000000000..45d84fc788534b --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-miterlimit/index.md @@ -0,0 +1,44 @@ +--- +title: stroke-miterlimit +slug: Web/SVG/Attribute/stroke-miterlimit +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/stroke-miterlimit +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +如果两条线交汇在一起形成一个尖角,而且属性{{ SVGAttr("stroke-linejoin") }}指定了`miter`,斜接有可能扩展到远远超过出路径轮廓线的线宽。属性`stroke-miterlimit 对斜接长度和`{{ SVGAttr("stroke-width") }}的比率`强加了一个极限。当极限到达时,交汇处由斜接变成倒角。` + +斜接长度(斜接的外尖角和内夹角之间的距离)与{{ SVGAttr("stroke-width") }}的比率,直接跟两条线之间的角度(θ)有关,用如下方程表示: + +```plain +miterLength / stroke-width = 1 / sin ( theta / 2 ) +``` + +举个例子,一个极限为 1.414 斜接,θ 小于 90 度的把斜接会转换成倒角,一个极限为 4.0 的斜接,θ 小于 29 度的斜接会转换成倒角,一个极限为 10.0 的斜接,θ 小于大约 11.5 度的斜接会转换成倒角。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | ----------------------- | +| 值 | \| inherit | +| 初始值 | 4 | +| 可动性 | Yes | + +- \ + - : 对斜角长度与{{ SVGAttr("stroke-width") }}的比率的限制。\的值必须是一个大于或等于 1 的[\](/en/SVG/Content_type#Number)。 + +## 示例 + +## 元素 + +下列元素可以使用`stroke-miterlimit`属性: + +- [形状元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-opacity/index.html b/files/zh-cn/web/svg/attribute/stroke-opacity/index.html deleted file mode 100644 index e7325a500c29ab..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-opacity/index.html +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: stroke-opacity -slug: Web/SVG/Attribute/stroke-opacity -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/stroke-opacity ---- -

« SVG 属性参考主页

- -

stroke-opacity属性指定了当前对象的轮廓的不透明度。它的默认值是1

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<opacity-value> | inherit
可变性Yes
- -
-
<opacity-value>
-
在当前对象的轮廓上用该涂色操作的不透明度。任何超出 0.0 到 1.0 范围的值都会被压回这个范围(0.0 表示完全透明,1.0 表示完全不透明)。
-
- -

示例

- -

SVG

- -
<svg width="120px" height="120px" viewBox="0 0 120 120">
-  <rect x="10" y="10" width="100" height="100"/>
-</svg>
- -

CSS

- -
rect{
-  fill:#b4da55;
-  stroke:#000;
-  stroke-width:10px;
-  stroke-opacity:0.3;
-}
- -

结果

- -
{{EmbedLiveSample("示例",150,150)}}
- -

元素

- -

下列元素可以使用stroke-opacity属性:

- - - -

规范

- -{{Specifications}} - -

参见

- -
    -
  • {{ SVGAttr("fill-opacity") }}
  • -
  • {{ SVGAttr("opacity") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/stroke-opacity/index.md b/files/zh-cn/web/svg/attribute/stroke-opacity/index.md new file mode 100644 index 00000000000000..f0ff3403c5302e --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-opacity/index.md @@ -0,0 +1,65 @@ +--- +title: stroke-opacity +slug: Web/SVG/Attribute/stroke-opacity +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/stroke-opacity +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`stroke-opacity`属性指定了当前对象的轮廓的不透明度。它的默认值是**1**。 + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | -------------------------- | +| 值 | \| inherit | +| 可变性 | Yes | + +- \ + - : 在当前对象的轮廓上用该涂色操作的不透明度。任何超出 0.0 到 1.0 范围的值都会被压回这个范围(0.0 表示完全透明,1.0 表示完全不透明)。 + +## 示例 + +### SVG + +```html + + + +``` + +### CSS + +```css +rect{ + fill:#b4da55; + stroke:#000; + stroke-width:10px; + stroke-opacity:0.3; +} +``` + +### 结果 + +{{EmbedLiveSample("示例",150,150)}} + +## 元素 + +下列元素可以使用`stroke-opacity`属性: + +- [形状元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} + +## 参见 + +- {{ SVGAttr("fill-opacity") }} +- {{ SVGAttr("opacity") }} diff --git a/files/zh-cn/web/svg/attribute/stroke-width/index.html b/files/zh-cn/web/svg/attribute/stroke-width/index.html deleted file mode 100644 index 1012905dfabfa8..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke-width/index.html +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: stroke-width -slug: Web/SVG/Attribute/stroke-width -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/stroke-width ---- -

« SVG 属性参考主页

- -

stroke-width属性指定了当前对象的轮廓的宽度。它的默认值是1。如果使用了一个<percentage>,这个值代表当前视口的百分比。如果使用了0值,则将不绘制轮廓。

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<length> | <percentage> | inherit
可变性Yes
- -

示例

- -

元素

- -

下列元素可以使用stroke-width属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke-width/index.md b/files/zh-cn/web/svg/attribute/stroke-width/index.md new file mode 100644 index 00000000000000..e2f0edad2e2592 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke-width/index.md @@ -0,0 +1,34 @@ +--- +title: stroke-width +slug: Web/SVG/Attribute/stroke-width +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/stroke-width +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`stroke-width`属性指定了当前对象的轮廓的宽度。它的默认值是**1**。如果使用了一个\,这个值代表当前视口的百分比。如果使用了**0**值,则将不绘制轮廓。 + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | ----------------------------------------------------------------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Length) \| [](/en/SVG/Content_type#Percentage) \| inherit | +| 可变性 | Yes | + +## 示例 + +## 元素 + +下列元素可以使用`stroke-width`属性: + +- [形状元素](/en/SVG/Element#Shape) » +- [文本内容元素](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke/index.html b/files/zh-cn/web/svg/attribute/stroke/index.html deleted file mode 100644 index 28c4be0dbd80ee..00000000000000 --- a/files/zh-cn/web/svg/attribute/stroke/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: stroke -slug: Web/SVG/Attribute/stroke -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/stroke ---- -

« SVG 属性参考主页

- -

stroke属性定义了给定图形元素的外轮廓的颜色。它的默认值是none

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
<paint>
可变性
- -

示例

- -

- -

SVG 描边的线

- -

示例 1:用 stroke 属性画一条绿色的直线。

- -
<svg height="50" width ="300">
-    <path stroke = "green" d="M5 20 1215 0" />
-</svg>
- -

- -

示例 2:用 Stroke 属性画一个拥有蓝色边框的黑色的圆形

- -
​​<svg height="200" width="200">
-    <circle cx="50" cy="50" r="40" stroke="blue" stroke-width="2" fill ="black" />
-</svg>
- -

- -

元素

- -

下列元素可以使用stroke属性:

- - - -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/stroke/index.md b/files/zh-cn/web/svg/attribute/stroke/index.md new file mode 100644 index 00000000000000..0704cf1050720b --- /dev/null +++ b/files/zh-cn/web/svg/attribute/stroke/index.md @@ -0,0 +1,54 @@ +--- +title: stroke +slug: Web/SVG/Attribute/stroke +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/stroke +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`stroke`属性定义了给定图形元素的外轮廓的颜色。它的默认值是**none**。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | ------------------------------------- | +| 值 | [](/en/SVG/Content_type#Paint) | +| 可变性 | 是 | + +## 示例 + +​ + +## SVG 描边的线 + +### 示例 1:用 stroke 属性画一条绿色的直线。 + +```html + + + +``` + +### + +### 示例 2:用 Stroke 属性画一个拥有蓝色边框的黑色的圆形 + +```html +​​ + + +``` + +## 元素 + +下列元素可以使用`stroke`属性: + +- [形状元素](https://developer.mozilla.org/en/SVG/Element#Shape) » +- [文本内容元素](https://developer.mozilla.org/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/style/index.html b/files/zh-cn/web/svg/attribute/style/index.html deleted file mode 100644 index 077d0edc0b48ec..00000000000000 --- a/files/zh-cn/web/svg/attribute/style/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: style -slug: Web/SVG/Attribute/style -tags: - - SVG - - SVG Attribute - - Style - - svg style -translation_of: Web/SVG/Attribute/style ---- -

« SVG Attribute reference home

- -

style 属性指定了指定其元素的样式信息。它的功能与 HTML 中的style属性相同。

- -

使用环境

- - - - - - - - - - - - - - - - -
CategoriesPresentation attribute
Value<style>
AnimatableNo
- -
-
<style>
-
样式数据的语法取决于样式表语言。默认情况下,如果未指定 {{ SVGAttr("contentStyleType") }},样式表语言为 CSS。
-
- -

示例

- -

以下示例展示了使用 CSS 作为样式表语言来使用 style 属性,为一个矩形框添加样式。

- -
<svg version="1.1" viewbox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg">
-  <rect height="300" width="600" x="200" y="100"
-     style="fill: red; stroke: blue; stroke-width: 3"/>
-</svg>
-
- -

元素

- -

以下元素可以使用 style 属性

- - - -

规范

- -{{Specifications}} - -

相关

- -
    -
  • {{ SVGElement("style") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/style/index.md b/files/zh-cn/web/svg/attribute/style/index.md new file mode 100644 index 00000000000000..9a660307bd4612 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/style/index.md @@ -0,0 +1,60 @@ +--- +title: style +slug: Web/SVG/Attribute/style +tags: + - SVG + - SVG Attribute + - Style + - svg style +translation_of: Web/SVG/Attribute/style +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +**`style`** 属性指定了指定其元素的样式信息。它的功能与 HTML 中的[style](/zh-CN/docs/Web/HTML/Global_attributes/style)属性相同。 + +## 使用环境 + +| Categories | Presentation attribute | +| ---------- | ---------------------- | +| Value | \ + +``` + +**Live sample** + +{{ EmbedLiveSample('示例','120','120') }} + +## 元素 + +以下元素可以运用文本锚点属性: + +- [Text content elements](/en/SVG/Element#Text_content_elements) » + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/text-decoration/index.html b/files/zh-cn/web/svg/attribute/text-decoration/index.html deleted file mode 100644 index cf9da0b2bfd349..00000000000000 --- a/files/zh-cn/web/svg/attribute/text-decoration/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: text-decoration -slug: Web/SVG/Attribute/text-decoration -translation_of: Web/SVG/Attribute/text-decoration ---- -

« SVG Attribute reference home

- -

text-decoration 属性的作用跟{{ cssxref("text-decoration","CSS Text Decoration") }} 特性差不多,当然除了它是一个 CSS 属性。浏览 {{ cssxref("text-decoration","CSS Text Decoration") }} 获取进一步的信息。

- -

使用环境

- - - - - - - - - - - - - - - - -
分类外观属性
none | underline | overline | line-through | blink | inherit
是否可用于动画Yes
- -

元素

- -
后代元素可以继承 text-decoration 这个属性
- - - -

规范

- -{{Specifications}} - -

相关

- -
    -
  • {{ cssxref("text-decoration", "CSS Text Decoration") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/text-decoration/index.md b/files/zh-cn/web/svg/attribute/text-decoration/index.md new file mode 100644 index 00000000000000..8261393bde09d0 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/text-decoration/index.md @@ -0,0 +1,31 @@ +--- +title: text-decoration +slug: Web/SVG/Attribute/text-decoration +translation_of: Web/SVG/Attribute/text-decoration +--- +« [SVG Attribute reference home](/en/SVG/Attribute) + +`text-decoration` 属性的作用跟{{ cssxref("text-decoration","CSS Text Decoration") }} 特性差不多,当然除了它是一个 CSS 属性。浏览 {{ cssxref("text-decoration","CSS Text Decoration") }} 获取进一步的信息。 + +## 使用环境 + +| 分类 | 外观属性 | +| -------------- | --------------------------------------------------------------------- | +| 值 | none \| underline \| overline \| line-through \| blink \| **inherit** | +| 是否可用于动画 | Yes | + +## 元素 + +```plain +后代元素可以继承 text-decoration 这个属性 +``` + +- [Text content elements](/en/SVG/Element#TextContent) » + +## 规范 + +{{Specifications}} + +## 相关 + +- {{ cssxref("text-decoration", "CSS Text Decoration") }} diff --git a/files/zh-cn/web/svg/attribute/transform/index.html b/files/zh-cn/web/svg/attribute/transform/index.html deleted file mode 100644 index 3c2c319eeed839..00000000000000 --- a/files/zh-cn/web/svg/attribute/transform/index.html +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: transform -slug: Web/SVG/Attribute/transform -translation_of: Web/SVG/Attribute/transform ---- -
{{SVGRef}}
- -

transform 属性定义了一系列应用于元素和元素子元素的变换规则集合

- -
- - -
<svg viewBox="-40 0 150 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-  <g fill="grey"
-     transform="rotate(-10 50 100)
-                translate(-36 45.5)
-                skewX(40)
-                scale(1 0.5)">
-    <path id="heart" d="M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z" />
-  </g>
-
-  <use xlink:href="#heart" fill="none" stroke="red"/>
-</svg>
-
- -

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

-
- -

提示: 从 SVG2 开始,transform 是一种图像属性,这意味着它可以用作 CSS 属性。但是请注意,CSS 属性和属性之间在语法上存在一些差异。有关在这种情况下使用的特定语法,请参见 CSS 属性{{cssxref('transform')}}的文档

- -

作为表示属性,任何元素都可以使用transform (在 SVG 1.1 中,仅这 16 个元素被允许使用:{{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('defs')}}, {{SVGElement('ellipse')}}, {{SVGElement('foreignObject')}}, {{SVGElement('g')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('switch')}}, {{SVGElement('text')}}, and {{SVGElement('use')}})。
-
- 另外,作为 SVG 1.1 的遗留物,{{SVGElement('linearGradient')}}和{{SVGElement('radialGradient')}}支持 gradientTransform 属性,而{{SVGElement('pattern')}}支持 patternTransform 属性,两者的行为完全相同于 transform 属性

- - - - - - - - - - - - - - - - -
Value<transform-list>
Default valuenone
AnimatableYes
- -

Transform functions

- -

transform 属性 <transform-list> 可以使用以下的所有 transform 函数

- -

警告: 根据规范,您还应该能够使用 CSS {{cssxref('transform-function', 'transform functions')}},但是,这不能保证兼容性。

- -

Matrix

- -

matrix(<a> <b> <c> <d> <e> <f>) 函数以六个值的变换矩阵形式指定一个 transform。 matrix(a,b,c,d,e,f)等同于应用变换矩阵: \ begin {pmatrix} a&c&e \\ b&d&f \\ 0&0&1 \ end {pmatrix} 通过以下矩阵等式将坐标从先前的坐标系映射到新的坐标系:
- (xnewCoordSysynewCoordSys1)=(acebdf001)(xprevCoordSysyprevCoordSys1)=(axprevCoordSys+cyprevCoordSys+ebxprevCoordSys+dyprevCoordSys+f1) \begin{pmatrix} x_{\mathrm{newCoordSys}} \\ y_{\mathrm{newCoordSys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x_{\mathrm{prevCoordSys}} \\ y_{\mathrm{prevCoordSys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a x_{\mathrm{prevCoordSys}} + c y_{\mathrm{prevCoordSys}} + e \\ b x_{\mathrm{prevCoordSys}} + d y_{\mathrm{prevCoordSys}} + f \\ 1 \end{pmatrix}

- -

举例

- - - -
<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
-  <rect x="10" y="10" width="30" height="20" fill="green" />
-
-  <!--
-  In the following example we are applying the matrix:
-  [a c e]    [3 -1 30]
-  [b d f] => [1  3 40]
-  [0 0 1]    [0  0  1]
-
-  which transform the rectangle as such:
-
-  top left corner: oldX=10 oldY=10
-  newX = a * oldX + c * oldY + e = 3 * 10 - 1 * 10 + 30 = 50
-  newY = b * oldX + d * oldY + f = 1 * 10 + 3 * 10 + 40 = 80
-
-  top right corner: oldX=40 oldY=10
-  newX = a * oldX + c * oldY + e = 3 * 40 - 1 * 10 + 30 = 140
-  newY = b * oldX + d * oldY + f = 1 * 40 + 3 * 10 + 40 = 110
-
-  bottom left corner: oldX=10 oldY=30
-  newX = a * oldX + c * oldY + e = 3 * 10 - 1 * 30 + 30 = 30
-  newY = b * oldX + d * oldY + f = 1 * 10 + 3 * 30 + 40 = 140
-
-  bottom right corner: oldX=40 oldY=30
-  newX = a * oldX + c * oldY + e = 3 * 40 - 1 * 30 + 30 = 120
-  newY = b * oldX + d * oldY + f = 1 * 40 + 3 * 30 + 40 = 170
-  -->
-  <rect x="10" y="10" width="30" height="20" fill="red"
-        transform="matrix(3 1 -1 3 30 40)" />
-</svg>
- -

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

- -

Translate

- -

translate(<x> [<y>]) 变换函数通过 x 向量和 y 向量移动元素 (i.e. xnew = xold + <x>, ynew = yold + <y>). 如果 y 向量没有被提供,那么默认为 0

- -

举例

- - - -
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
-  <!-- No translation -->
-  <rect x="5" y="5" width="40" height="40" fill="green" />
-
-  <!-- Horizontal translation -->
-  <rect x="5" y="5" width="40" height="40" fill="blue"
-        transform="translate(50)" />
-
-  <!-- Vertical translation -->
-  <rect x="5" y="5" width="40" height="40" fill="red"
-        transform="translate(0 50)" />
-
-  <!-- Both horizontal and vertical translation -->
-  <rect x="5" y="5" width="40" height="40" fill="yellow"
-         transform="translate(50,50)" />
-</svg>
- -

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

- -

Scale

- -

scale(<x> [<y>]) 变换函数通过 xy指定一个 等比例放大缩小 操作。如果 y 没有被提供,那么假定为等同于 x

- -

举例

- - - -
<svg viewBox="-50 -50 100 100" xmlns="http://www.w3.org/2000/svg">
-  <!-- uniform scale -->
-  <circle cx="0" cy="0" r="10" fill="red"
-          transform="scale(4)" />
-
-  <!-- vertical scale -->
-  <circle cx="0" cy="0" r="10" fill="yellow"
-          transform="scale(1,4)" />
-
-  <!-- horizontal scale -->
-  <circle cx="0" cy="0" r="10" fill="pink"
-          transform="scale(4,1)" />
-
-  <!-- No scale -->
-  <circle cx="0" cy="0" r="10" fill="black" />
-</svg>
- -

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

- -

Rotate

- -

rotate(<a> [<x> <y>]) 变换方法通过一个给定角度对一个指定的点进行旋转变换。如果 x 和 y 没有提供,那么默认为当前元素坐标系原点。否则,就以(x,y)为原点进行旋转。

- -

举例

- - - -
<svg viewBox="-12 -2 34 14" xmlns="http://www.w3.org/2000/svg">
-  <rect x="0" y="0" width="10" height="10" />
-
-  <!-- rotation is done around the point 0,0 -->
-  <rect x="0" y="0" width="10" height="10" fill="red"
-        transform="rotate(100)" />
-
-  <!-- rotation is done around the point 10,10 -->
-  <rect x="0" y="0" width="10" height="10" fill="green"
-        transform="rotate(100,10,10)" />
-</svg>
- -

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

- -

SkewX

- -

skewX(<a>) 变换函数指定了沿 x 轴倾斜 的倾斜变换。

- -

举例

- - - -
<svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg">
-  <rect x="-3" y="-3" width="6" height="6" />
-
-  <rect x="-3" y="-3" width="6" height="6" fill="red"
-        transform="skewX(30)" />
-</svg>
- -

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

- -

SkewY

- -

skewY(<a>) 变换函数指定了沿 y 轴倾斜 的倾斜变换。

- -

举例

- - - -
<svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg">
-  <rect x="-3" y="-3" width="6" height="6" />
-
-  <rect x="-3" y="-3" width="6" height="6" fill="red"
-        transform="skewY(30)" />
-</svg>
- -

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

- -

Specification

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/transform/index.md b/files/zh-cn/web/svg/attribute/transform/index.md new file mode 100644 index 00000000000000..c5f92036e1f538 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/transform/index.md @@ -0,0 +1,224 @@ +--- +title: transform +slug: Web/SVG/Attribute/transform +translation_of: Web/SVG/Attribute/transform +--- +{{SVGRef}} + +**`transform`** 属性定义了一系列应用于元素和元素子元素的变换规则集合 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + +``` + +{{EmbedLiveSample('topExample', '100%', 200)}} + +**提示:** 从 SVG2 开始,transform 是一种图像属性,这意味着它可以用作 CSS 属性。但是请注意,CSS 属性和属性之间在语法上存在一些差异。有关在这种情况下使用的特定语法,请参见 CSS 属性{{cssxref('transform')}}的文档 + +作为表示属性,任何元素都可以使用**`transform`** (在 SVG 1.1 中,仅这 16 个元素被允许使用:{{SVGElement('a')}}, {{SVGElement('circle')}}, {{SVGElement('clipPath')}}, {{SVGElement('defs')}}, {{SVGElement('ellipse')}}, {{SVGElement('foreignObject')}}, {{SVGElement('g')}}, {{SVGElement('image')}}, {{SVGElement('line')}}, {{SVGElement('path')}}, {{SVGElement('polygon')}}, {{SVGElement('polyline')}}, {{SVGElement('rect')}}, {{SVGElement('switch')}}, {{SVGElement('text')}}, and {{SVGElement('use')}})。 + +另外,作为 SVG 1.1 的遗留物,{{SVGElement('linearGradient')}}和{{SVGElement('radialGradient')}}支持 `gradientTransform `属性,而{{SVGElement('pattern')}}支持 `patternTransform `属性,两者的行为完全相同于 `transform` 属性 + +| Value | **[](/docs/Web/SVG/Content_type#Transform-list)** | +| ------------- | ----------------------------------------------------------------- | +| Default value | _none_ | +| Animatable | Yes | + +## Transform functions + +`transform` 属性 *` `*可以使用以下的所有 `transform `函数 + +**警告:** 根据规范,您还应该能够使用 CSS {{cssxref('transform-function', 'transform functions')}},但是,这不能保证兼容性。 + +### Matrix + +`matrix( )` 函数以六个值的变换矩阵形式指定一个 `transform`。 matrix(a,b,c,d,e,f)等同于应用变换矩阵: \ begin {pmatrix} a&c&e \\\ b&d&f \\\ 0&0&1 \ end {pmatrix} 通过以下矩阵等式将坐标从先前的坐标系映射到新的坐标系: (xnewCoordSysynewCoordSys1)=(acebdf001)(xprevCoordSysyprevCoordSys1)=(axprevCoordSys+cyprevCoordSys+ebxprevCoordSys+dyprevCoordSys+f1) \begin{pmatrix} x*{\mathrm{newCoordSys}} \\ y*{\mathrm{newCoordSys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x*{\mathrm{prevCoordSys}} \\ y*{\mathrm{prevCoordSys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a x*{\mathrm{prevCoordSys}} + c y*{\mathrm{prevCoordSys}} + e \\ b x*{\mathrm{prevCoordSys}} + d y*{\mathrm{prevCoordSys}} + f \\ 1 \end{pmatrix} + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + +``` + +{{EmbedLiveSample('Matrix', '100%', 200)}} + +### Translate + +`translate( [])` 变换函数通过 `x` 向量和 `y` 向量移动元素 (i.e. `xnew = xold + , ynew = yold + `). 如果 `y` 向量没有被提供,那么默认为 `0` + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('Translate', '100%', 200)}} + +### Scale + +`scale( [])` 变换函数通过 `x` 和 `y`指定一个 **等比例放大缩小** 操作。如果 `y` 没有被提供,那么假定为等同于 `x` + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('Scale', '100%', 200)}} + +### Rotate + +`rotate( [ ])` 变换方法通过一个给定角度对一个指定的点进行旋转变换。如果 x 和 y 没有提供,那么默认为当前元素坐标系原点。否则,就以`(x,y)`为原点进行旋转。 + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + + + + + +``` + +{{EmbedLiveSample('Rotate', '100%', 200)}} + +### SkewX + +`skewX()` 变换函数指定了沿 `x` 轴倾斜 `a°` 的倾斜变换。 + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + +``` + +{{EmbedLiveSample('SkewX', '100%', 200)}} + +### SkewY + +`skewY()` 变换函数指定了沿 `y` 轴倾斜 `a°` 的倾斜变换。 + +#### 举例 + +```css hidden +html,body,svg { height:100% } +``` + +```html + + + + + +``` + +{{EmbedLiveSample('SkewY', '100%', 200)}} + +## Specification + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/type/index.html b/files/zh-cn/web/svg/attribute/type/index.html deleted file mode 100644 index 1c5d68b6060780..00000000000000 --- a/files/zh-cn/web/svg/attribute/type/index.html +++ /dev/null @@ -1,152 +0,0 @@ ---- -title: type -slug: Web/SVG/Attribute/type -translation_of: Web/SVG/Attribute/type ---- -
{{SVGRef}}
- -

type 属性是一个类属性,他在不同的使用语境下有不同的意思。

- -
    -
  • 对于{{SVGElement("animateTransform")}}元素 , 它决定了那些随时间变化的值的转换的类型
  • -
  • 对于 {{SVGElement("feColorMatrix")}} 元素,它指明了矩阵运算的类型。关键词 matrix 表明一个全 5x4 矩阵的值会被提供。其他关键字快捷方式代表允许不执行复杂矩阵运算下使用常用颜色。
  • -
  • 对于{{SVGElement("feFuncR")}}, {{SVGElement("feFuncG")}}, {{SVGElement("feFuncB")}}, 和{{SVGElement("feFuncA")}} 元素,它指明了组件传递函数的类型。
  • -
  • 对于 {{SVGElement("feTurbulence")}} 元素,它表示应以噪声函数还是湍流函数执行过滤。
  • -
  • 对于 {{SVGElement("style")}} 和 {{SVGElement("script")}} 元素,它定义了元素内容的类型。
  • -
- -

Usage context

- -

For the {{SVGElement("animateTransform")}} elements

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
Valuetranslate | scale | rotate | skewX | skewY
AnimatableNo
Normative documentSVG 1.1 (2nd Edition)
- -

For the {{ SVGElement("feColorMatrix") }} element

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
Valuematrix | saturate | hueRotate | luminanceToAlpha
AnimatableYes
Normative documentSVG 1.1 (2nd Edition)
- -

For the {{ SVGElement("feFuncR") }}, {{ SVGElement("feFuncG") }}, {{ SVGElement("feFuncB") }}, and {{ SVGElement("feFuncA") }} elements

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
Valueidentity | table | discrete | linear | gamma
AnimatableYes
Normative documentSVG 1.1 (2nd Edition)
- -

For the {{ SVGElement("feTurbulence") }} element

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
ValuefractalNoise | turbulence
AnimatableYes
Normative documentSVG 1.1 (2nd Edition)
- -

For the {{ SVGElement("style") }} and {{SVGElement("script")}} elements

- - - - - - - - - - - - - - - - - - - - -
CategoriesNone
Value<content-type>
AnimatableNo
Normative documentSVG 1.1 (2nd Edition) : script
- SVG 1.1 (2nd Edition) : style
- -

Example

- -

Elements

- -

The following elements can use the values attribute

- -
    -
  • {{SVGElement("animateTransform")}}
  • -
  • {{SVGElement("feColorMatrix")}}
  • -
  • {{SVGElement("feFuncA")}}
  • -
  • {{SVGElement("feFuncB")}}
  • -
  • {{SVGElement("feFuncG")}}
  • -
  • {{SVGElement("feFuncR")}}
  • -
  • {{SVGElement("feTurbulence")}}
  • -
  • {{SVGElement("script")}}
  • -
  • {{SVGElement("style")}}
  • -
diff --git a/files/zh-cn/web/svg/attribute/type/index.md b/files/zh-cn/web/svg/attribute/type/index.md new file mode 100644 index 00000000000000..6c832a95c75e6f --- /dev/null +++ b/files/zh-cn/web/svg/attribute/type/index.md @@ -0,0 +1,72 @@ +--- +title: type +slug: Web/SVG/Attribute/type +translation_of: Web/SVG/Attribute/type +--- +{{SVGRef}} + +type 属性是一个类属性,他在不同的使用语境下有不同的意思。 + +- 对于{{SVGElement("animateTransform")}}元素 , 它决定了那些随时间变化的值的转换的类型 +- 对于 {{SVGElement("feColorMatrix")}} 元素,它指明了矩阵运算的类型。关键词 `matrix` 表明一个全 5x4 矩阵的值会被提供。其他关键字快捷方式代表允许不执行复杂矩阵运算下使用常用颜色。 +- 对于{{SVGElement("feFuncR")}}, {{SVGElement("feFuncG")}}, {{SVGElement("feFuncB")}}, 和{{SVGElement("feFuncA")}} 元素,它指明了组件传递函数的类型。 +- 对于 {{SVGElement("feTurbulence")}} 元素,它表示应以噪声函数还是湍流函数执行过滤。 +- 对于 {{SVGElement("style")}} 和 {{SVGElement("script")}} 元素,它定义了元素内容的类型。 + +## Usage context + +### For the {{SVGElement("animateTransform")}} elements + +| Categories | _None_ | +| ------------------ | ----------------------------------------------------------------------------------------------------- | +| Value | **`translate`** \| `scale` \| `rotate` \| `skewX` \| `skewY` | +| Animatable | No | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/animate.html#AnimateTransformElementTypeAttribute) | + +### For the {{ SVGElement("feColorMatrix") }} element + +| Categories | _None_ | +| ------------------ | ------------------------------------------------------------------------------------------- | +| Value | **`matrix`** \| `saturate` \| `hueRotate` \| `luminanceToAlpha` | +| Animatable | Yes | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#feColorMatrixTypeAttribute) | + +### For the {{ SVGElement("feFuncR") }}, {{ SVGElement("feFuncG") }}, {{ SVGElement("feFuncB") }}, and {{ SVGElement("feFuncA") }} elements + +| Categories | _None_ | +| ------------------ | ------------------------------------------------------------------------------------------------- | +| Value | `identity` \| `table` \| `discrete` \| `linear` \| `gamma` | +| Animatable | Yes | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#feComponentTransferTypeAttribute) | + +### For the {{ SVGElement("feTurbulence") }} element + +| Categories | _None_ | +| ------------------ | ------------------------------------------------------------------------------------------ | +| Value | `fractalNoise` \| **`turbulence`** | +| Animatable | Yes | +| Normative document | [SVG 1.1 (2nd Edition)](http://www.w3.org/TR/SVG11/filters.html#feTurbulenceTypeAttribute) | + +### For the {{ SVGElement("style") }} and {{SVGElement("script")}} elements + +| Categories | _None_ | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Value | | +| Animatable | No | +| Normative document | [SVG 1.1 (2nd Edition) : script](http://www.w3.org/TR/SVG11/script.html#ScriptElementTypeAttribute) [SVG 1.1 (2nd Edition) : style](http://www.w3.org/TR/SVG11/styling.html#StyleElementTypeAttribute) | + +## Example + +## Elements + +The following elements can use the `values` attribute + +- {{SVGElement("animateTransform")}} +- {{SVGElement("feColorMatrix")}} +- {{SVGElement("feFuncA")}} +- {{SVGElement("feFuncB")}} +- {{SVGElement("feFuncG")}} +- {{SVGElement("feFuncR")}} +- {{SVGElement("feTurbulence")}} +- {{SVGElement("script")}} +- {{SVGElement("style")}} diff --git a/files/zh-cn/web/svg/attribute/units-per-em/index.html b/files/zh-cn/web/svg/attribute/units-per-em/index.html deleted file mode 100644 index 1ea629c4f0944a..00000000000000 --- a/files/zh-cn/web/svg/attribute/units-per-em/index.html +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: units-per-em -slug: Web/SVG/Attribute/units-per-em -translation_of: Web/SVG/Attribute/units-per-em ---- -
{{SVGRef}}{{deprecated_header("SVG 2")}}
- -

The units-per-em attribute specifies the number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. This is the size of the design grid on which {{Glossary("glyph", "glyphs")}} are laid out.

- -
-

Note: This value is almost always necessary as nearly every other attribute requires the definition of a design grid.

-
- -

Only one element is using this attribute: {{SVGElement("font-face")}}

- -

Usage notes

- - - - - - - - - - - - - - - - -
Value<number>
Default value1000
AnimatableNo
- -
-
<number>
-
This value indicates the the number of coordinate units on the em square.
-
- -

Specifications

- -{{Specifications}} - -

Browser compatibility

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/units-per-em/index.md b/files/zh-cn/web/svg/attribute/units-per-em/index.md new file mode 100644 index 00000000000000..4a3d414473ed2a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/units-per-em/index.md @@ -0,0 +1,30 @@ +--- +title: units-per-em +slug: Web/SVG/Attribute/units-per-em +translation_of: Web/SVG/Attribute/units-per-em +--- +{{SVGRef}}{{deprecated_header("SVG 2")}} + +The **`units-per-em`** attribute specifies the number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. This is the size of the design grid on which {{Glossary("glyph", "glyphs")}} are laid out. + +> **备注:** This value is almost always necessary as nearly every other attribute requires the definition of a design grid. + +Only one element is using this attribute: {{SVGElement("font-face")}} + +## Usage notes + +| Value | [``](/en-US/docs/Web/SVG/Content_type#Number) | +| ------------- | ----------------------------------------------------- | +| Default value | `1000` | +| Animatable | No | + +- `` + - : This value indicates the the number of coordinate units on the em square. + +## Specifications + +{{Specifications}} + +## Browser compatibility + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/values/index.html b/files/zh-cn/web/svg/attribute/values/index.html deleted file mode 100644 index 317a6e77d8e99a..00000000000000 --- a/files/zh-cn/web/svg/attribute/values/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: values -slug: Web/SVG/Attribute/values -translation_of: Web/SVG/Attribute/values ---- -
{{SVGRef}}
- -

values 属性具有不同的含义,具体取决于使用的上下文,它可以定义在动画过程中使用的值序列,或者它是颜色矩阵的数字列表,根据颜色类型的不同,它们的解释也不同。 要执行的颜色更改。

- -

五个元素正在使用此属性: {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, {{SVGElement("animateTransform")}}, and {{SVGElement("feColorMatrix")}}

- -

animate, animateColor, animateMotion, animateTransform

- -

对于 {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, 和 {{SVGElement("animateTransform")}}, values是一个列表 定义动画过程中的值序列的值。 如果指定了此属性,则将忽略在元素上设置的任何 {{SVGAttr("from")}}, {{SVGAttr("to")}}, 和 {{SVGAttr("by")}} 属性值。

- - - - - - - - - - - - - - - - -
Value<list-of-values>
Default valueNone
AnimatableNo
- -
-
<list-of-values>
-
该值包含一个或多个值的分号分隔列表。 值的类型由 {{SVGAttr("href")}} 和 {{SVGAttr("attributeName")}} 属性定义。
-
- -

feColorMatrix

- -

对于 {{SVGElement("feColorMatrix")}} 元素,值是根据 {{SVGAttr("type")}} 属性值不同解释的数字列表。

- - - - - - - - - - - - - - - - -
Value<list-of-numbers>
Default valueIf type="matrix", identity matrix,
- if type="saturate", 1, resulting in identity matrix,
- if type="hueRotate", 0, resulting in identity matrix
AnimatableYes
- -
-
<list-of-numbers>
-
-

该值是一个数字列表,根据 type 属性的值来定义不同解释:

- -
    -
  • For type="matrix", values 是 20 个矩阵值(a00 a01 a02 a03 a04 a10 a11 ... a34)的列表,以空格和/或逗号分隔。
  • -
  • For type="saturate", values 是单个实数值(0 到 1)。
  • -
  • For type="hueRotate", values 是一个单一的实数值(度)。.
  • -
  • For type="luminanceToAlpha", values 不适用。
  • -
-
-
- -

Specifications

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/values/index.md b/files/zh-cn/web/svg/attribute/values/index.md new file mode 100644 index 00000000000000..5379ef27066842 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/values/index.md @@ -0,0 +1,43 @@ +--- +title: values +slug: Web/SVG/Attribute/values +translation_of: Web/SVG/Attribute/values +--- +{{SVGRef}} + +values 属性具有不同的含义,具体取决于使用的上下文,它可以定义在动画过程中使用的值序列,或者它是颜色矩阵的数字列表,根据颜色类型的不同,它们的解释也不同。 要执行的颜色更改。 + +五个元素正在使用此属性: {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, {{SVGElement("animateTransform")}}, and {{SVGElement("feColorMatrix")}} + +## animate, animateColor, animateMotion, animateTransform + +对于 {{SVGElement("animate")}}, {{SVGElement("animateColor")}}, {{SVGElement("animateMotion")}}, 和 {{SVGElement("animateTransform")}}, `values`是一个列表 定义动画过程中的值序列的值。 如果指定了此属性,则将忽略在元素上设置的任何 {{SVGAttr("from")}}, {{SVGAttr("to")}}, 和 {{SVGAttr("by")}} 属性值。 + +| Value | [``](/en-US/docs/Web/SVG/Content_type#List-of-Ts) | +| ------------- | ----------------------------------------------------------------- | +| Default value | _None_ | +| Animatable | No | + +- `` + - : 该值包含一个或多个值的分号分隔列表。 值的类型由 {{SVGAttr("href")}} 和 {{SVGAttr("attributeName")}} 属性定义。 + +## feColorMatrix + +对于 {{SVGElement("feColorMatrix")}} 元素,值是根据 {{SVGAttr("type")}} 属性值不同解释的数字列表。 + +| Value | [``](/en-US/docs/Web/SVG/Content_type#List-of-Ts) | +| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Default value | _If `type="matrix"`, identity matrix, if `type="saturate"`, `1`, resulting in identity matrix, if `type="hueRotate"`, `0`, resulting in identity matrix_ | +| Animatable | Yes | + +- `` + - : 该值是一个数字列表,根据 type 属性的值来定义不同解释: + + - `type="matrix"`,`values` 是 20 个矩阵值(a00 a01 a02 a03 a04 a10 a11 ... a34)的列表,以空格和/或逗号分隔。 + - `type="saturate"`,`values` 是单个实数值(0 到 1)。 + - `type="hueRotate"`,`values` 是一个单一的实数值(度)。 + - `type="luminanceToAlpha"`,`values` 不适用。 + +## Specifications + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/vector-effect/index.html b/files/zh-cn/web/svg/attribute/vector-effect/index.html deleted file mode 100644 index 786b234d9f5045..00000000000000 --- a/files/zh-cn/web/svg/attribute/vector-effect/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: vector-effect -slug: Web/SVG/Attribute/vector-effect -translation_of: Web/SVG/Attribute/vector-effect ---- -
{{SVGRef}}
- -

vector-effect 属性指明绘制对象时要使用的矢量效果。在任何其他合成操作(如滤镜,蒙版和剪辑等)之前,都要应用矢量效果。

- -

备注: 作为显示性属性, vector-effect 也可以直接在 CSS 样式表中作为属性使用。

- -

作为显示性属性,它能被应用到任何元素,但只对这 10 个元素有效果: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("foreignObject")}}, {{SVGElement("image")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, {{SVGElement("rect")}}, {{SVGElement("text")}}, {{SVGElement("textPath")}} {{SVGElement("tspan")}}, and {{SVGElement("use")}}

- -

用法说明

- - - - - - - - - - - - - - - - -
none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position
默认值none
可动画性
- -
-
none
-
该值指定不应用矢量效果,即,使用默认的渲染行为,即首先用指定的绘画填充形状的几何形状,然后使用指定的绘画描边轮廓。
-
non-scaling-stroke
-
该值修改了笔触的方式。通常,笔触涉及在当前用户坐标系中计算形状路径的笔触轮廓,并用笔触颜料(颜色或渐变)填充轮廓。该值的最终视觉效果是笔触宽度不依赖于元素的变换(包括非均匀缩放和剪切变换)和缩放级别。
-
non-scaling-size
-
该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间进行任何转换更改,该用户坐标系的比例也不会更改。但是,它没有指定抑制旋转和偏斜。同样,它也不指定用户坐标系的原点。由于此值抑制了用户坐标系的缩放,因此它还具有non-scaling-stroke的特性。
-
non-rotation
-
该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间发生任何变换更改,该用户坐标系的旋转和倾斜仍被抑制。但是,它没有指定抑制缩放。同样,它也没有指定用户坐标系的原点。
-
fixed-position
-
该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间进行任何转换更改,用户坐标系的位置都是固定的。但是,它没有指定抑制旋转,偏斜和缩放。当同时指定了该矢量效果和 {{SVGAttr("transform")}} 属性, {{SVGAttr("transform")}} 属性将因该矢量效果而被消耗。
-
- -

示例

- -

Example: vector-effect="non-scaling-stroke"

- -
<svg viewBox="0 0 500 240">
-  <!-- normal -->
-  <path d="M10,20L40,100L39,200z" stroke="black" stroke-width="2px" fill="none"></path>
-
-  <!-- scaled -->
-  <path transform="translate(100,0)scale(4,1)" d="M10,20L40,100L39,200z" stroke="black"
-      stroke-width="2px" fill="none"></path>
-
-  <!-- fixed-->
-  <path vector-effect="non-scaling-stroke" transform="translate(300,0)scale(4,1)" d="M10,20L40,100L39,200z"
-      stroke="black" stroke-width="2px" fill="none"></path>
-</svg>
-
- -

结果

- -

{{EmbedLiveSample("Example_vector-effectnon-scaling-stroke", 550, 300)}}

- -

规范

- -{{Specifications}} - -

浏览器兼容性

- -

{{Compat}}

diff --git a/files/zh-cn/web/svg/attribute/vector-effect/index.md b/files/zh-cn/web/svg/attribute/vector-effect/index.md new file mode 100644 index 00000000000000..dbf0e1fb8484a3 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/vector-effect/index.md @@ -0,0 +1,61 @@ +--- +title: vector-effect +slug: Web/SVG/Attribute/vector-effect +translation_of: Web/SVG/Attribute/vector-effect +--- +{{SVGRef}} + +**`vector-effect`** 属性指明绘制对象时要使用的矢量效果。在任何其他合成操作(如滤镜,蒙版和剪辑等)之前,都要应用矢量效果。 + +**备注:** 作为显示性属性, `vector-effect` 也可以直接在 CSS 样式表中作为属性使用。 + +作为显示性属性,它能被应用到任何元素,但只对这 10 个元素有效果: {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("foreignObject")}}, {{SVGElement("image")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, {{SVGElement("rect")}}, {{SVGElement("text")}}, {{SVGElement("textPath")}} {{SVGElement("tspan")}}, and {{SVGElement("use")}} + +## 用法说明 + +| 值 | `none` \| `non-scaling-stroke` \| `non-scaling-size` \| `non-rotation` \| `fixed-position` | +| -------- | ------------------------------------------------------------------------------------------ | +| 默认值 | `none` | +| 可动画性 | 是 | + +- `none` + - : 该值指定不应用矢量效果,即,使用默认的渲染行为,即首先用指定的绘画填充形状的几何形状,然后使用指定的绘画描边轮廓。 +- `non-scaling-stroke` + - : 该值修改了笔触的方式。通常,笔触涉及在当前用户坐标系中计算形状路径的笔触轮廓,并用笔触颜料(颜色或渐变)填充轮廓。该值的最终视觉效果是笔触宽度不依赖于元素的变换(包括非均匀缩放和剪切变换)和缩放级别。 +- `non-scaling-size` + - : 该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间进行任何转换更改,该用户坐标系的比例也不会更改。但是,它没有指定抑制旋转和偏斜。同样,它也不指定用户坐标系的原点。由于此值抑制了用户坐标系的缩放,因此它还具有`non-scaling-stroke`的特性。 +- `non-rotation` + - : 该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间发生任何变换更改,该用户坐标系的旋转和倾斜仍被抑制。但是,它没有指定抑制缩放。同样,它也没有指定用户坐标系的原点。 +- `fixed-position` + - : 该值指定元素及其后代使用的特殊用户坐标系。尽管从宿主坐标空间进行任何转换更改,用户坐标系的位置都是固定的。但是,它没有指定抑制旋转,偏斜和缩放。当同时指定了该矢量效果和 {{SVGAttr("transform")}} 属性, {{SVGAttr("transform")}} 属性将因该矢量效果而被消耗。 + +## 示例 + +### Example: vector-effect="non-scaling-stroke" + +```html + + + + + + + + + + +``` + +#### 结果 + +{{EmbedLiveSample("Example_vector-effectnon-scaling-stroke", 550, 300)}} + +## 规范 + +{{Specifications}} + +## 浏览器兼容性 + +{{Compat}} diff --git a/files/zh-cn/web/svg/attribute/version/index.html b/files/zh-cn/web/svg/attribute/version/index.html deleted file mode 100644 index ff2b93fc531fce..00000000000000 --- a/files/zh-cn/web/svg/attribute/version/index.html +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: version -slug: Web/SVG/Attribute/version -translation_of: Web/SVG/Attribute/version ---- -

version 属性用于指明 SVG 文档遵循规范。 它只允许在根元素<svg> 上使用。 它纯粹是一个说明,对渲染或处理没有任何影响。

- -

虽然它接受任何数字,但是只有1.01.1.这两个有效的选择。

- -

Usage context

- - - - - - - - - - - - - - - - -
类别None
<number>
动画属性No
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/version/index.md b/files/zh-cn/web/svg/attribute/version/index.md new file mode 100644 index 00000000000000..6c7b6371e256a9 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/version/index.md @@ -0,0 +1,19 @@ +--- +title: version +slug: Web/SVG/Attribute/version +translation_of: Web/SVG/Attribute/version +--- +**`version`** 属性用于指明 SVG 文档遵循规范。 它只允许在根元素[\](/zh-CN/docs/Web/SVG/Element/svg) 上使用。 它纯粹是一个说明,对渲染或处理没有任何影响。 + +虽然它接受任何数字,但是只有`1.0` 和 `1.1`.这两个有效的选择。 + +## Usage context + +| 类别 | None | +| -------- | --------------------------------------- | +| 值 | [](/en/SVG/Content_type#Number) | +| 动画属性 | No | + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/viewbox/index.html b/files/zh-cn/web/svg/attribute/viewbox/index.html deleted file mode 100644 index 67297a5b12d5c3..00000000000000 --- a/files/zh-cn/web/svg/attribute/viewbox/index.html +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: viewBox -slug: Web/SVG/Attribute/viewBox -tags: - - SVG - - SVG Attribute - - viewBox -translation_of: Web/SVG/Attribute/viewBox ---- -

« SVG 属性参考

- -

viewBox 属性允许指定一个给定的一组图形伸展以适应特定的容器元素。

- -

viewBox 属性的值是一个包含 4 个参数的列表 min-x, min-y, width and height, 以空格或者逗号分隔开, 在用户空间中指定一个矩形区域映射到给定的元素,查看属性{{ SVGAttr("preserveAspectRatio") }}。

- -

不允许宽度和高度为负值,0 则禁用元素的呈现。

- -
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
-  <!--
-  with relative unit such as percentage, the visual size
-  of the square looks unchanged regardless of the viewBox
-  -->
-  <rect x="0" y="0" width="100%" height="100%"/>
-
-  <!--
-  with a large viewBox the circle looks small
-  as it is using user units for the r attribute:
-  4 resolved against 100 as set in the viewBox
-  -->
-  <circle cx="50%" cy="50%" r="4" fill="white"/>
-</svg>
-
-<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
-  <!--
-  with relative unit such as percentage, the visual size
-  of the square looks unchanged regardless of the viewBox`
-  -->
-  <rect x="0" y="0" width="100%" height="100%"/>
-
-  <!--
-  with a small viewBox the circle looks large
-  as it is using user units for the r attribute:
-  4 resolved against 10 as set in the viewBox
-  -->
-  <circle cx="50%" cy="50%" r="4" fill="white"/>
-</svg>
-
-<svg viewBox="-5 -5 10 10" xmlns="http://www.w3.org/2000/svg">
-  <!--
-  The point of coordinate 0,0 is now in the center of the viewport,
-  and 100% is still resolve to a width or height of 10 user units so
-  the rectangle looks shifted to the bottom/right corner of the viewport
-  -->
-  <rect x="0" y="0" width="100%" height="100%"/>
-
-  <!--
-  With the point of coordinate 0,0 in the center of the viewport the
-  value 50% is resolve to 5 which means the center of the circle is
-  in the bottom/right corner of the viewport.
-  -->
-  <circle cx="50%" cy="50%" r="4" fill="white"/>
-</svg>
- -

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

- - - -

这个属性会受到 {{ SVGAttr("preserveAspectRatio") }} 的影响。

- -
-

温馨提示::width 或者 height 的值,小于或等于 0 的情况下,这个元素将不会被渲染出来。

-
- -

有 {{SVGElement("marker")}}, {{SVGElement("pattern")}}, {{ SVGElement("svg") }}, {{ SVGElement("symbol") }}, 和 {{ SVGElement("view") }} 等五个 svg 元素可以有这个属性。

- -

Usage context

- - - - - - - - - - - - - - - - -
CategoriesNone
ValueSee above
AnimatableYes
- -

Elements

- -

下面的元素可以使用 viewBox 属性

- -
    -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("symbol") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("marker") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("view") }}
  • -
- -

规范

- -{{Specifications}} - -

See also

- - diff --git a/files/zh-cn/web/svg/attribute/viewbox/index.md b/files/zh-cn/web/svg/attribute/viewbox/index.md new file mode 100644 index 00000000000000..88ab618ea2c917 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/viewbox/index.md @@ -0,0 +1,98 @@ +--- +title: viewBox +slug: Web/SVG/Attribute/viewBox +tags: + - SVG + - SVG Attribute + - viewBox +translation_of: Web/SVG/Attribute/viewBox +--- +« [SVG 属性参考](/en/SVG/Attribute) + +viewBox 属性允许指定一个给定的一组图形伸展以适应特定的容器元素。 + +viewBox 属性的值是一个包含 4 个参数的列表 `min-x`, `min-y`, `width` and `height`, 以空格或者逗号分隔开, 在用户空间中指定一个矩形区域映射到给定的元素,查看属性{{ SVGAttr("preserveAspectRatio") }}。 + +不允许宽度和高度为负值,0 则禁用元素的呈现。 + +```html + + + + + + + + + + + + + + + + + + + + + + + +``` + +{{EmbedLiveSample('topExample', '100%', 200)}} + +这个属性会受到 {{ SVGAttr("preserveAspectRatio") }} 的影响。 + +> **备注:** `width` 或者 `height` 的值,小于或等于 0 的情况下,这个元素将不会被渲染出来。 + +有 {{SVGElement("marker")}}, {{SVGElement("pattern")}}, {{ SVGElement("svg") }}, {{ SVGElement("symbol") }}, 和 {{ SVGElement("view") }} 等五个 svg 元素可以有这个属性。 + +## Usage context + +| Categories | None | +| ---------- | ----------- | +| Value | _See above_ | +| Animatable | Yes | + +## Elements + +下面的元素可以使用 viewBox 属性 + +- {{ SVGElement("svg") }} +- {{ SVGElement("symbol") }} +- {{ SVGElement("image") }} +- {{ SVGElement("marker") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("view") }} + +## 规范 + +{{Specifications}} + +## See also + +- [SVG Getting Started: Positions](/en/SVG/Tutorial/Positions) diff --git a/files/zh-cn/web/svg/attribute/visibility/index.html b/files/zh-cn/web/svg/attribute/visibility/index.html deleted file mode 100644 index 3bbc9b9c7718b8..00000000000000 --- a/files/zh-cn/web/svg/attribute/visibility/index.html +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: visibility -slug: Web/SVG/Attribute/visibility -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/visibility ---- -

« SVG 属性参考主页

- -

visibility属性让你能够控制一个图形元素的可见性。用了值hidden或者值collapse,当前的图形元素将不可见。

- -
注意:如果 {{ SVGElement("tspan") }}元素、{{ SVGElement("tref") }}元素或{{ SVGElement("altGlyph") }}元素上的visibility属性设置为hidden,则文本变得不可见,但是依然占用文本布局计算的空间。
- -

根据属性{{ SVGAttr("pointer-events") }}的值,图形元素如果属性visibility 值设置为 hidden,依然能够响应事件。

- -

作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。请阅读{{ cssxref("visibility","CSS visibility") }}以了解更多信息。

- -

用法

- - - - - - - - - - - - - - - - -
类别外观属性
visible | hidden | collapse | inherit
可变性Yes
- -

示例

- -

元素

- -

下列元素楞以使用visibility属性:

- - - -

规范

- -{{Specifications}} - -

参见

- -
    -
  • 属性{{ SVGAttr("display") }}
  • -
  • {{ cssxref("visibility","CSS visibility") }}
  • -
diff --git a/files/zh-cn/web/svg/attribute/visibility/index.md b/files/zh-cn/web/svg/attribute/visibility/index.md new file mode 100644 index 00000000000000..08716467218135 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/visibility/index.md @@ -0,0 +1,43 @@ +--- +title: visibility +slug: Web/SVG/Attribute/visibility +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/visibility +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +`visibility`属性让你能够控制一个图形元素的可见性。用了值`hidden`或者值`collapse`,当前的图形元素将不可见。 + +> **备注:** 如果 {{ SVGElement("tspan") }}元素、{{ SVGElement("tref") }}元素或{{ SVGElement("altGlyph") }}元素上的`visibility`属性设置为`hidden`,则文本变得不可见,但是依然占用文本布局计算的空间。 + +根据属性{{ SVGAttr("pointer-events") }}的值,图形元素如果属性`visibility 值设置为 hidden,依然能够响应事件。` + +作为一个外观属性,它可以直接用作 CSS 样式表内部的属性。请阅读{{ cssxref("visibility","CSS visibility") }}以了解更多信息。 + +## 用法 + +| 类别 | 外观属性 | +| ------ | -------------------------------------------- | +| 值 | **visible** \| hidden \| collapse \| inherit | +| 可变性 | Yes | + +## 示例 + +## 元素 + +下列元素楞以使用`visibility`属性: + +- [图形元素](/en/SVG/Element#Graphics) » +- [文本内容元素](/en/SVG/Element#Text_content_elements) » + +## 规范 + +{{Specifications}} + +## 参见 + +- 属性{{ SVGAttr("display") }} +- {{ cssxref("visibility","CSS visibility") }} diff --git a/files/zh-cn/web/svg/attribute/width/index.html b/files/zh-cn/web/svg/attribute/width/index.html deleted file mode 100644 index e65fe151945889..00000000000000 --- a/files/zh-cn/web/svg/attribute/width/index.html +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: width -slug: Web/SVG/Attribute/width -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/width ---- -

« SVG 属性参考主页

- -

该属性在用户坐标系统中标识了一个水平长度。该坐标的确切效果依赖于每个元素。大多数时候,它体现引用元素的矩形区域的宽度(请阅读每个元素的文档以了解例外情况)。

- -

除了<svg>元素之外,别的元素都必须指定该属性,<svg>的宽度默认是100%,而<filter>元素以及<mask>元素的默认宽度是120%

- -

用法

- - - - - - - - - - - - - - - - -
类别
<length>
可变性Yes
- -

{{ page("/zh-CN/docs/Web/SVG/Content_type","长度") }}

- -

元素

- -

下列元素可以使用width属性:

- -
    -
  • 滤镜元素 »
  • -
  • {{ SVGElement("filter") }}
  • -
  • {{ SVGElement("foreignObject") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("rect") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("use") }}
  • -
  • {{ SVGElement("mask") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/width/index.md b/files/zh-cn/web/svg/attribute/width/index.md new file mode 100644 index 00000000000000..863e1104dd784a --- /dev/null +++ b/files/zh-cn/web/svg/attribute/width/index.md @@ -0,0 +1,41 @@ +--- +title: width +slug: Web/SVG/Attribute/width +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/width +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性在用户坐标系统中标识了一个水平长度。该坐标的确切效果依赖于每个元素。大多数时候,它体现引用元素的矩形区域的宽度(请阅读每个元素的文档以了解例外情况)。 + +除了``元素之外,别的元素都必须指定该属性,``的宽度默认是**100%**,而``元素以及``元素的默认宽度是**120%**。 + +## 用法 + +| 类别 | 无 | +| ------ | --------------------------------------- | +| 值 | [](/en/SVG/Content_type#Length) | +| 可变性 | Yes | + +{{ page("/zh-CN/docs/Web/SVG/Content_type","长度") }} + +## 元素 + +下列元素可以使用`width`属性: + +- [滤镜元素](/en/SVG/Element#FilterPrimitive) » +- {{ SVGElement("filter") }} +- {{ SVGElement("foreignObject") }} +- {{ SVGElement("image") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("rect") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("use") }} +- {{ SVGElement("mask") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/x/index.html b/files/zh-cn/web/svg/attribute/x/index.html deleted file mode 100644 index a919985dd3ee8c..00000000000000 --- a/files/zh-cn/web/svg/attribute/x/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: x -slug: Web/SVG/Attribute/x -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/x ---- -

« SVG 属性参考主页

- -

该属性在用户坐标系统中标识了一个 x 轴坐标。本坐标的确切效果依赖于每个元素。大多数时候,它体现了引用元素的矩形区域的左上角的 x 轴坐标(请阅读每个元素的文档以了解例外情况)。

- -

如果没有指定这个属性,效果相当于值被设置为 0,除了{{ SVGElement("filter") }}元素以及{{ SVGElement("mask") }}元素;这两个元素的x默认值为-10%

- -

用法

- - - - - - - - - - - - - - - - -
类别
<coordinate>
可变性Yes
- -

{{ page("/en/SVG/Content_type","coordinate") }}

- -

元素

- -

下列元素可以使用x属性:

- -
    -
  • 滤镜元素 »
  • -
  • {{ SVGElement("altGlyph") }}
  • -
  • {{ SVGElement("fePointLight") }}
  • -
  • {{ SVGElement("feSpotLight") }}
  • -
  • {{ SVGElement("filter") }}
  • -
  • {{ SVGElement("foreignObject") }}
  • -
  • {{ SVGElement("glyphRef") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("rect") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("text") }}
  • -
  • {{ SVGElement("use") }}
  • -
  • {{ SVGElement("mask") }}
  • -
  • {{ SVGElement("tref") }}
  • -
  • {{ SVGElement("tspan") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/x/index.md b/files/zh-cn/web/svg/attribute/x/index.md new file mode 100644 index 00000000000000..b4f0d4e782e171 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/x/index.md @@ -0,0 +1,48 @@ +--- +title: x +slug: Web/SVG/Attribute/x +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/x +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性在用户坐标系统中标识了一个 x 轴坐标。本坐标的确切效果依赖于每个元素。大多数时候,它体现了引用元素的矩形区域的左上角的 x 轴坐标(请阅读每个元素的文档以了解例外情况)。 + +如果没有指定这个属性,效果相当于值被设置为 0,除了{{ SVGElement("filter") }}元素以及{{ SVGElement("mask") }}元素;这两个元素的`x`默认值为**-10%**。 + +## 用法 + +| 类别 | 无 | +| ------ | ----------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Coordinate) | +| 可变性 | Yes | + +{{ page("/en/SVG/Content_type","coordinate") }} + +## 元素 + +下列元素可以使用`x`属性: + +- [滤镜元素](/en/SVG/Element#FilterPrimitive) » +- {{ SVGElement("altGlyph") }} +- {{ SVGElement("fePointLight") }} +- {{ SVGElement("feSpotLight") }} +- {{ SVGElement("filter") }} +- {{ SVGElement("foreignObject") }} +- {{ SVGElement("glyphRef") }} +- {{ SVGElement("image") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("rect") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("text") }} +- {{ SVGElement("use") }} +- {{ SVGElement("mask") }} +- {{ SVGElement("tref") }} +- {{ SVGElement("tspan") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/y/index.html b/files/zh-cn/web/svg/attribute/y/index.html deleted file mode 100644 index 429824e6d392b0..00000000000000 --- a/files/zh-cn/web/svg/attribute/y/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: 'y' -slug: Web/SVG/Attribute/y -tags: - - SVG - - SVG 属性 - - 需要兼容性表 -translation_of: Web/SVG/Attribute/y ---- -

« SVG 属性参考主页

- -

该属性在用户坐标系统中标识了一个 y 轴坐标。本坐标的确切效果依赖于每个元素。大多数时候,它体现了引用元素的矩形区域的左上角的 y 轴坐标(请阅读每个元素的文档以了解例外情况)。

- -

如果没有指定这个属性,效果相当于值被设置为0,除了<filter>元素以及<mask>元素;这两个元素的y默认值为-10%

- -

用法

- - - - - - - - - - - - - - - - -
类别
<coordinate>
可变性Yes
- -

{{ page("/en/SVG/Content_type","coordinate") }}

- -

元素

- -

下列元素可以使用y属性:

- -
    -
  • 滤镜元素 »
  • -
  • {{ SVGElement("altGlyph") }}
  • -
  • {{ SVGElement("fePointLight") }}
  • -
  • {{ SVGElement("feSpotLight") }}
  • -
  • {{ SVGElement("filter") }}
  • -
  • {{ SVGElement("foreignObject") }}
  • -
  • {{ SVGElement("glyphRef") }}
  • -
  • {{ SVGElement("image") }}
  • -
  • {{ SVGElement("pattern") }}
  • -
  • {{ SVGElement("rect") }}
  • -
  • {{ SVGElement("svg") }}
  • -
  • {{ SVGElement("text") }}
  • -
  • {{ SVGElement("use") }}
  • -
  • {{ SVGElement("mask") }}
  • -
  • {{ SVGElement("tref") }}
  • -
  • {{ SVGElement("tspan") }}
  • -
- -

规范

- -{{Specifications}} diff --git a/files/zh-cn/web/svg/attribute/y/index.md b/files/zh-cn/web/svg/attribute/y/index.md new file mode 100644 index 00000000000000..fa87d8be3eadd5 --- /dev/null +++ b/files/zh-cn/web/svg/attribute/y/index.md @@ -0,0 +1,48 @@ +--- +title: 'y' +slug: Web/SVG/Attribute/y +tags: + - SVG + - SVG 属性 + - 需要兼容性表 +translation_of: Web/SVG/Attribute/y +--- +« [SVG 属性参考主页](/en/SVG/Attribute) + +该属性在用户坐标系统中标识了一个 y 轴坐标。本坐标的确切效果依赖于每个元素。大多数时候,它体现了引用元素的矩形区域的左上角的 y 轴坐标(请阅读每个元素的文档以了解例外情况)。 + +如果没有指定这个属性,效果相当于值被设置为**0**,除了[``](/zh-CN/docs/Web/SVG/Element/filter)元素以及[``](/zh-CN/docs/Web/SVG/Element/mask)元素;这两个元素的`y`默认值为**-10%**。 + +## 用法 + +| 类别 | 无 | +| ------ | ----------------------------------------------- | +| 值 | [](/en/SVG/Content_type#Coordinate) | +| 可变性 | Yes | + +{{ page("/en/SVG/Content_type","coordinate") }} + +## 元素 + +下列元素可以使用`y`属性: + +- [滤镜元素](/en/SVG/Element#FilterPrimitive) » +- {{ SVGElement("altGlyph") }} +- {{ SVGElement("fePointLight") }} +- {{ SVGElement("feSpotLight") }} +- {{ SVGElement("filter") }} +- {{ SVGElement("foreignObject") }} +- {{ SVGElement("glyphRef") }} +- {{ SVGElement("image") }} +- {{ SVGElement("pattern") }} +- {{ SVGElement("rect") }} +- {{ SVGElement("svg") }} +- {{ SVGElement("text") }} +- {{ SVGElement("use") }} +- {{ SVGElement("mask") }} +- {{ SVGElement("tref") }} +- {{ SVGElement("tspan") }} + +## 规范 + +{{Specifications}} diff --git a/files/zh-cn/web/svg/content_type/index.html b/files/zh-cn/web/svg/content_type/index.html deleted file mode 100644 index 161bc24052bca6..00000000000000 --- a/files/zh-cn/web/svg/content_type/index.html +++ /dev/null @@ -1,373 +0,0 @@ ---- -title: Content type -slug: Web/SVG/Content_type -tags: - - SVG - - 需要技术预览 -translation_of: Web/SVG/Content_type ---- -

角度

- -
-
<angle>
-
-

可以用两种办法指定角度。如果用在样式表的属性的值中,<angle> 可以用如下方法定义:

- -
angle ::= number (~"deg" | ~"grad" | ~"rad")?
- -

在这里 deg 标识了度数,grad 标识了斜率,rad 标识了弧度。

- -

对于定义在 CSS2 中的属性,必须提供一个角度单位标识符。对于在 SVG 特有的属性和它们对应的外观属性中的角度值,角度单位标识符是可选的。如果没有提供,角度值会被潜在分配一个度数单位。在所有元素的外观属性中,无论是在 SVG1.1 中定义的,还是在 CSS2 中定义的,如果指定了角度标识符,角度标识符必须是小写的。

- -

如果角度用在一个 SVG 属性中,<angle>可以用以下方式定义:

- -
angle ::= number ("deg" | "grad" | "rad")?
- -

在这个<angle>值中,单位标识符必须是小写的。

- -

在 SVG DOM 中,<angle> 值使用{{domxref("SVGAngle")}}或{{domxref("SVGAnimatedAngle objects")}}表达。

-
-
- -

任意值

- -
-
<anything>
-
-

基本类型 <anything> 是一个零字符或多字符的序列。具体如下:

- -
anything ::= Char*
- -

在这里,Char 表示一个字符,XML 1.0 第 2.2 节中定义了它。

-
-
- -

时钟值

- -
-
<clock-value>
-
-

时钟值的句法与SMIL Animation规范中写的句法相同。在这里重放一下时钟值的语法:

- -
Clock-val         ::= Full-clock-val | Partial-clock-val | Timecount-val
-Full-clock-val    ::= Hours ":" Minutes ":" Seconds ("." Fraction)?
-Partial-clock-val ::= Minutes ":" Seconds ("." Fraction)?
-Timecount-val     ::= Timecount ("." Fraction)? (Metric)?
-Metric            ::= "h" | "min" | "s" | "ms"
-Hours             ::= DIGIT+; any positive number
-Minutes           ::= 2DIGIT; range from 00 to 59
-Seconds           ::= 2DIGIT; range from 00 to 59
-Fraction          ::= DIGIT+
-Timecount         ::= DIGIT+
-2DIGIT            ::= DIGIT DIGIT
-DIGIT             ::= [0-9]
-
- -

对于Timecount值,默认的公制前缀是 “s”(秒)。在时钟值中不能嵌入空白,而且前导和末尾的空白字符会被忽略掉。

- -

下面是合法的时钟值的示例:

- -
    -
  • 完整时钟值:
    - 02:30:03 = 2 小时 30 分钟又 3 秒
    - 50:00:10.25 = 50 小时 10 秒又 250 毫秒
  • -
  • 部分时钟值:
    - 02:33 = 2 分钟又 33 秒
    - 00:10.5 = 10.5 秒 = 10 秒又 500 毫秒
  • -
  • Timecount 值:
    - 3.2h = 3.2 小时 = 3 小时 12 分钟
    - 45min = 45 分钟
    - 30s = 30 秒
    - 5ms = 5 毫秒
    - 12.467 = 12 秒又 467 毫秒
  • -
- -

小数值是基数为 10 的浮点数,秒的界定。因此:

- -

00.5s = 500 毫秒
- 00:00.005 = 5 毫秒

-
-
- -

颜色

- -
-
<color>
-
-

基本类型<color>是一个 CSS2 兼容的规范,针对 sRGB 颜色空间的颜色。<color> 应用在 SVG 的属性 {{SVGAttr("color")}} 上,也是属性{{SVGAttr("fill")}}、属性{{SVGAttr("stroke")}}、属性{{SVGAttr("stop-color")}}、属性 {{SVGAttr("flood-color")}}和属性{{SVGAttr("lighting-color")}}的定义的组成部分,<color> 还提供了可选的基于 ICC 的颜色规范。

- -

SVG 支持所有的定义在CSS2 句法和基本数据类型中的 <color> 供选择的句法,而且还支持CSS Color Module Level 3中的 <color> 句法(取决于编译器)。

- -

一个<color> 可以是一个关键词,或者一个数字化的 RGB 规范。

- -

除了这些颜色关键词,用户可以利用用户环境中的对象指定对应于颜色的关键词。 这些关键词的规范定义可以在用户对颜色的引用(CSS2 规范第 18.2 节)中找到。

- -

一个 16 进制记号法的 RGB 值的格式是一个 “#” 后面紧跟着 3 个或者 6 个 16 进制字符。三数字 RGB 记号法(#rgb)可以转换成六数字 RGB 格式(#rrggbb),只需要复制数字,而不是添加 0。举个例子,#fb0 扩展为 #ffbb00。这样确保白色(#ffffff)可以用缩写记法 #fff 指定,去掉任何对显示器的色深的依赖。一个函数记号法的 RGB 值的格式是一个 RGB 开头函数后面跟着一个逗号分隔的三数值数列(可以是三个数字或者三个百分数)后面跟着一个右括号 “)”。一个 RGB 开头函数是一个大小写不敏感的字符串 “rgb(”,举个例子,“RGB(” 或者 “rGb(”。为了兼容性,建议使用全小写形式 “rgb(”。整型值 255 对应于 100%,也对应于 16 进制计号法中的 F 或 FF:rgb(255,255,255) = rgb(100%,100%,100%) = #FFF。数字值周围允许存在空白字符。所有的 RGB 值都指定在 sRGB 颜色空间里。使用 sRGB 提供了一个清楚的、客观的、可测量的颜色定义,可以关联到国际标准。

- -
color    ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
-             | "rgb("integer, integer, integer")"
-             | "rgb("integer "%", integer "%", integer "%)"
-             | color-keyword
-hexdigit ::= [0-9A-Fa-f]
-
- -

在这里,color-keyword 要于匹配列于CSS Color Module Level 3中的颜色关键词(大小写不敏感)中的一个,要么匹配列于对颜色的用户参考中的一个。

- -

SVG DOM 对 <color> 的定义,CSS 中也做了同样的定义。SVG 对颜色的扩展,包括指定基于 ICC 的颜色的能力,可以使用 DOM 接口{{domxref("SVGColor")}}来表现。

-
-
- -

坐标

- -
-
<coordinate>
-
-

一个<coordinate> 是一个用户坐标系统中的长度,是从用户坐标系统的原点沿着相关轴走出给定的距离(X 轴针对 X 坐标,Y 轴针对 Y 坐标)。它的句法与<length>相同。

- -

在 SVG DOM 内部,一个 <coordinate> 代表了一个{{domxref("SVGLength")}} 或者一个{{domxref("SVGAnimatedLength")}}.

-
-
- -

频率

- -
-
<frequency>
-
-

频率值用在可听到的属性上。就如 CSS2 中所定义的,一个频率值是一个<number>后面跟着一个频率单位标识符。频率单位标识符可以是:

- -
    -
  • Hz:赫兹
  • -
  • kHz:千赫
  • -
- -

频率值不能是负数。

-
-
- -

FuncIRI

- -
-
<FuncIRI>
-
用于引用的功能记号法,该引用的句法与{{cssxref("uri", "CSS URI")}}相同。
-
- -

ICC 颜色

- -
-
<icccolor>
-
-

<icccolor> 一份 ICC 颜色规范。在 SVG 1.1,一份 ICC 颜色规范,顾名思义,是一个参考了一个{{SVGElement("color-profile")}} 元素,以及一个或更多颜色成分值。语法如下所示:

- -
icccolor ::= "icc-color(" name (, number)+ ")"
-
- -

<icccolor>对应的 SVG DOM 接口是{{domxref("SVGICCColor")}}。

-
-
- -

整型数

- -
-
<integer>
-
-

用一个可选的正负符号(“+” 或 “-”)后面跟着一个或多个 0 到 9 的数字可以指定一个<integer>:

- -
integer ::= [+-]? [0-9]+
- -

如果正负符号不出现,则这个数字是非负的。

- -

除非是另有声明为特殊的属性,<integer> 的范围是 -2147483648 到 2147483647 之间。

- -

在 SVG DOM 内部,一个 <integer> 代表了一个数字或者一个{{domxref("SVGAnimatedInteger")}}。

-
-
- -

IRI

- -
-
<IRI>
-
-

一个国际化资源标识符。

- -

在因特网上,资源是用IRI(一个国际化资源标识符)标识的。举个例子,一个 SVG 文档调用了位于 http://example.com 上的 someDrawing.svg,可以使用下面的IRI

- -
http://example.com/someDrawing.svg
-
- -

一个IRI中包含一个IRI片段标识符,就可以定位一个 XML 文档内部的特定的元素。一个包含有IRI片段标识符的IRI,由一个可选的基础IRI后面跟着一个“#”号,再跟着一个IRI片段标识符组成。举个例子,下面的 IRI 可以用来指定文件 someDrawing.svg 中的 ID 为“Lamppost”的元素:

- -
http://example.com/someDrawing.svg#Lamppost
-
- -

IRIs 用在{{SVGAttr("xlink:href")}}属性中。有些属性既允许IRI作为内容,也允许文本字符串。为了消除歧意,避免一个文本字符串被当作 IRI,可以使用功能记号法<FuncIRI>。这只是简单用功能记号法分隔一个 IRI。注意:出于历史原因,为了与 CSS 规范兼容,分隔符是“url(”和“)”。该FuncIRI格式用在外观属性中。

- -

SVG 广泛地使用了IRI引用,引用对象既可以是绝对引用也可以是引对引用。举个例子,要用线性渐变填充一个矩形,你可以先定义一个{{SVGElement("linearGradient")}}元素,然后给它一个 ID,如下:

- -
<linearGradient xml:id="MyGradient">...</linearGradient>
-
- -

然后你再引用这个线性渐变,作为矩形的属性{{SVGAttr("fill")}}的值,如下:

- -
<rect fill="url(#MyGradient)"/>
-
- -

SVG 支持两种类型的IRI 引用:

- -
    -
  • 本地IRI引用,在这里 IRI 引用不能包含一个<absoluteIRI><relativeIRI>,因此只能包含一个片段标识符(例如: #<elementID> 或者#xpointer(id<elementID>))。
  • -
  • 非本地IRI引用,在这里IRI引用必须包含一个<absoluteIRI><relativeIRI>。
  • -
- -

欲了解完整的 SVG 中的 IRI 引用的规范请阅读SVG 1.1 (2nd Edition): IRI references

-
-
- -

长度

- -
-
<length>
-
-

一个长度是一个可度量的距离,给定一个数字以及一个单位。长度可以用两种方法指定。如果在样式表中使用它,可以如下定义<length>:

- -
length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?
- -

请阅读CSS2 规范 以了解单位标识符的意义。

- -

在 CSS2 中定义的长度属性,必须提供单位标识符。而 SVG 专用属性的长度值以及它们对应的外观属性,长度单位标识符是可选的。如果没有提供单位标识符,长度值代表当前用户坐标系统中的一段距离。对于外观属性,无论是定义在 SVG1.1 还是定义在 CSS2 中,长度单位标识符必须是小写的。

- -

如果是在 SVG 属性中使用长度,<length>需定义如下:

- -
length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
- -

在这样的<length>值中,单位标识符必须是小写的。

- -

注意,非属性<length>定义同样允许百分比单位标识符。这意味着一个百分比长度值依赖于被指定百分比长度值的属性。分两种情况:

- -
    -
  • 百分比长度值表达了一个视口宽度或高度的百分比;
  • -
  • 百分比长度值表达了一个给定对象上的边界盒的宽度或高度的百分比。
  • -
- -

在 SVG DOM 中,<length>值可以用{domxref("SVGLength")}}对象或{{domxref("SVGAnimatedLength")}}对象来表达。

-
-
- -

T值数列

- -
-
<list-of-Ts>
-
-

(在这里T 某些类型。)由一系列分开的值构成的数列。除非另有说明,SVG 的 XML 属性内的数列既可以是逗号分隔的,也可以是空格分隔的。用逗号作分隔符,逗号前面或后面可有带空格。

- -

数列中的空白被定义为一个或多个下列连续字符:“空格”(U+0020)、“制表符”(U+0009)、 “换行符”(U+000A)、 “回车符”(U+000D)以及“换页符”(U+000C)。

- -

下面是一个 EBNF 语法的模板,用来描述<list-of-Ts>句法:

- -
list-of-Ts ::= T | T, list-of-Ts
- -

在 SVG DOM 内部,<list-of-Ts>类型的值可以用一个限特定类型T的接口来表达。举个例子,SVG DOM 中的<list-of-lengths>使用一个{{domxref("SVGLengthList")}}对象或者{{domxref("SVGAnimatedLengthList")}}对象来表达。

-
-
- -

命名

- -
-
<name>
-
-

一个命名,是一个字符串,是不符合句法意义的少量的字符。

- -
name  ::= [^,()#x20#x9#xD#xA] /* 除了 ",", "(", ")" 或 wsp 之外的任何字符 */
-
-
- -

数字

- -
-
<number>
-
-

真实数字可以用两种方法指定。如果用在样式表中,一个 <number> 可以如下定义:

- -
number ::= integer | [+-]? [0-9]* "." [0-9]+
- -

该句法与 CSS(CSS2 第 4.3.1 章节)中的定义一样。

- -

如果用在一个 SVG 属性中,一个 <number> 可以用别的方法定义,允许一个数字后面跟着大数指数,以指定得更精确:

- -
number ::= integer ([Ee] integer)?| [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?
- -

在 SVG DOM 内部,一个 <number> 可以用浮点数、{{domxref("SVGNumber")}}对象或者{{domxref("SVGAnimatedNumber")}}对象来表达。

-
-
- -

带可取舍的后缀数字的数字

- -
-
<number-optional-number>
-
-

一对<number>,其中第二个 <number> 是可视情况取舍的。

- -
number-optional-number ::= number | number, number
- -

在 SVG DOM 中,一个 <number-optional-number> 可以用一对{{domxref("SVGAnimatedInteger")}}对象或者一对{{domxref("SVGAnimatedNumber")}}对象来表达。

-
-
- -

不透明度值

- -
-
<opacity-value>
-
颜色不透明度或者当前对象填充的内容的不透明度,它是一个<number>。任何超出 0.0 到 1.0 范围的值将被压制回这个范围。0.0 表示完全透明,1.0 表示完全不透明。
-
- -

涂色

- -
-
<paint>
-
-

属性{{SVGAttr("fill")}}和属性{{SVGAttr("stroke")}}的值,是涂色类型的规范,用在要对一个给定元素填充或描边的时候。SVG 规范的Specifying paint章节中描述了<paint>可用的选项以及句法。

- -

在 SVG DOM 内部,<paint> 值用{{domxref("SVGPaint")}}对象表达。

-
-
- -

百分数

- -
-
<percentage>
-
-

一个数字后面跟着一个百分号“%”就可以指定一个百分数。

- -
percentage ::= number "%"
- -

注意<number> 的意义取决于百分数是在一个样式表中指定的,还是在一个 SVG 属性非外观属性中指定的。

- -

百分数值总是关联到另一个值。举个例子,每种允许百分比的属性同时定义了引用了给百分比数参考的距离测量。

- -

在 SVG DOM 内部,<percentage> 用{{domxref("SVGNumber")}}对象或{{domxref("SVGAnimatedNumber")}}对象表达。

-
-
- -

时间

- -
-
<time>
-
-

一个时间值是一个 <number> 后面紧跟着时间单位标识符。时间单位标识符可以是:

- -
    -
  • ms:毫秒
  • -
  • s:秒
  • -
-
-
- -

平移数列

- -
-
<transform-list>
-
-

一个<transform-list> 是用来指定一个坐标系统转换数列。属性{{SVGAttr("transform")}}的定义中给出了 <transform-list> 的可用值的详细描述。

- -

在 SVG DOM 内部,一个 <transform-list> 值是用了一个{{domxref("SVGTransformList")}}对象或者{{domxref("SVGAnimatedTransformList")}}对象来表达的。

-
-
diff --git a/files/zh-cn/web/svg/content_type/index.md b/files/zh-cn/web/svg/content_type/index.md new file mode 100644 index 00000000000000..3be75e9cf4470d --- /dev/null +++ b/files/zh-cn/web/svg/content_type/index.md @@ -0,0 +1,271 @@ +--- +title: Content type +slug: Web/SVG/Content_type +--- +SVG 中使用了许多数据类型。本文列出了这些数据类型以及它们的语法和用途的描述。 + +## 角度 + +- \ + - : 可以用两种办法指定角度。如果用在样式表的属性的值中,`` 可以用如下方法定义:`plain angle ::= number (~"deg" | ~"grad" | ~"rad")?` 在这里 deg 标识了度数,grad 标识了斜率,rad 标识了弧度。对于定义在 CSS2 中的属性,必须提供一个角度单位标识符。对于在 SVG 特有的属性和它们对应的外观属性中的角度值,角度单位标识符是可选的。如果没有提供,角度值会被潜在分配一个度数单位。在所有元素的外观属性中,无论是在 SVG1.1 中定义的,还是在 CSS2 中定义的,如果指定了角度标识符,角度标识符必须是小写的。如果角度用在一个 SVG 属性中,``可以用以下方式定义: + + ```plain + angle ::= number ("deg" | "grad" | "rad")? + ``` + + 在这个 \ 值中,单位标识符必须是小写的。在 SVG DOM 中,\ 值使用{{domxref("SVGAngle")}}或{{domxref("SVGAnimatedAngle objects")}}表达。 + +## 任意值 + +- \ + - : 基本类型 \ 是一个零字符或多字符的序列。具体如下: + + ```plain + anything ::= Char\* + ``` + + 在这里,[Char](http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char) 表示一个字符,XML 1.0 第 2.2 节中定义了它。 + +## 时钟值 + +- \ + - : 时钟值的句法与 [SMIL Animation](https://www.w3.org/TR/2001/REC-smil-animation-20010904/) 规范中写的句法相同。在这里重放一下时钟值的语法: + + ``` + Clock-val ::= Full-clock-val | Partial-clock-val | Timecount-val + Full-clock-val ::= Hours ":" Minutes ":" Seconds ("." Fraction)? + Partial-clock-val ::= Minutes ":" Seconds ("." Fraction)? + Timecount-val ::= Timecount ("." Fraction)? (Metric)? + Metric ::= "h" | "min" | "s" | "ms" + Hours ::= DIGIT+; any positive number + Minutes ::= 2DIGIT; range from 00 to 59 + Seconds ::= 2DIGIT; range from 00 to 59 + Fraction ::= DIGIT+ + Timecount ::= DIGIT+ + 2DIGIT ::= DIGIT DIGIT + DIGIT ::= [0-9] + ``` + + 对于 `Timecount` 值,默认的公制前缀是 “s”(秒)。在时钟值中不能嵌入空白,而且前导和末尾的空白字符会被忽略掉。下面是合法的时钟值的示例: + + - 完整时钟值: + - `02:30:03` >= 2 小时 30 分钟又 3 秒 + - `50:00:10.25` = 50 小时 10 秒又 250 毫秒 + + - 部分时钟值: + - `02:33` >= 2 分钟又 33 秒 + - `00:10.5` = 10.5 秒 = 10 秒又 500 毫秒 + + - Timecount 值: + - `3.2h` >= 3.2 小时 = 3 小时 12 分钟 + - `45min` >= 45 分钟 + - `30s` >= 30 秒 + - `5ms` >= 5 毫秒 + - `12.467` >= 12 秒又 467 毫秒 + + - 小数值是基数为 10 的浮点数,秒的界定。因此: + - `00.5s` = 500 毫秒 + - `00:00.005` = 5 毫秒 + +## 颜色 + +- \ + - : 基本类型\是一个 CSS2 兼容的规范,针对 sRGB 颜色空间的颜色。\ 应用在 SVG 的属性 {{SVGAttr("color")}} 上,也是属性{{SVGAttr("fill")}}、属性{{SVGAttr("stroke")}}、属性{{SVGAttr("stop-color")}}、属性 {{SVGAttr("flood-color")}}和属性{{SVGAttr("lighting-color")}}的定义的组成部分,\ 还提供了可选的基于 ICC 的颜色规范。 + + SVG 支持所有的定义在[CSS2 句法和基本数据类型](http://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#value-def-color)中的 \ 供选择的句法,而且还支持[CSS Color Module Level 3](http://www.w3.org/TR/css3-color/)中的 \ 句法(取决于编译器)。 + + 一个 \ 可以是一个关键词,或者一个数字化的 RGB 规范。除了这些颜色关键词,用户可以利用用户环境中的对象指定对应于颜色的关键词。 这些关键词的规范定义可以在[用户对颜色的引用](http://www.w3.org/TR/2008/REC-CSS2-20080411/ui.html#system-colors)(CSS2 规范第 18.2 节)中找到。 + + 一个 16 进制记号法的 RGB 值的格式是一个 “#” 后面紧跟着 3 个或者 6 个 16 进制字符。三数字 RGB 记号法(#rgb)可以转换成六数字 RGB 格式(#rrggbb),只需要复制数字,而不是添加 0。举个例子,#fb0 扩展为 #ffbb00。这样确保白色(#ffffff)可以用缩写记法 #fff 指定,去掉任何对显示器的色深的依赖。一个函数记号法的 RGB 值的格式是一个 RGB 开头函数后面跟着一个逗号分隔的三数值数列(可以是三个数字或者三个百分数)后面跟着一个右括号 “)”。一个 RGB 开头函数是一个大小写不敏感的字符串 “rgb(”,举个例子,“RGB(” 或者 “rGb(”。为了兼容性,建议使用全小写形式 “rgb(”。整型值 255 对应于 100%,也对应于 16 进制计号法中的 F 或 FF:`rgb(255,255,255)` = `rgb(100%,100%,100%)` = `#FFF`。数字值周围允许存在空白字符。所有的 RGB 值都指定在 sRGB 颜色空间里。使用 sRGB 提供了一个清楚的、客观的、可测量的颜色定义,可以关联到国际标准。 + + ```plain + color ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)? + | "rgb("integer, integer, integer")" + | "rgb("integer "%", integer "%", integer "%)" + | color-keyword + hexdigit ::= [0-9A-Fa-f] + ``` + + 在这里,color-keyword 要于匹配列于 [CSS Color Module Level 3](http://www.w3.org/TR/css3-color/) 中的颜色关键词(大小写不敏感)中的一个,要么匹配列于[对颜色的用户参考](http://www.w3.org/TR/2008/REC-CSS2-20080411/ui.html#system-colors)中的一个。SVG DOM 对 \ 的定义,CSS 中也做了同样的定义。SVG 对颜色的扩展,包括指定基于 ICC 的颜色的能力,可以使用 DOM 接口{{domxref("SVGColor")}}来表现。 + +## 坐标 + +- \ + - : 一个\ 是一个用户坐标系统中的长度,是从用户坐标系统的原点沿着相关轴走出给定的距离(X 轴针对 X 坐标,Y 轴针对 Y 坐标)。它的句法与[\](/zh-CN/docs/SVG/Content_type#length)相同。在 SVG DOM 内部,一个 \ 代表了一个{{domxref("SVGLength")}} 或者一个{{domxref("SVGAnimatedLength")}}. + +## 频率 + +- \ + - : 频率值用在可听到的属性上。就如 CSS2 中所定义的,一个频率值是一个 [\](/zh-CN/docs/SVG/Content_type#Number) 后面跟着一个频率单位标识符。频率单位标识符可以是: + + - `Hz`:赫兹 + - `kHz`:千赫 + + 频率值不能是负数。 + +## FuncIRI + +- \ + - : 用于引用的功能记号法,该引用的句法与{{cssxref("uri", "CSS URI")}}相同。 + +## ICC 颜色 + +- \ + - : \ 一份 ICC 颜色规范。在 SVG 1.1,一份 ICC 颜色规范,顾名思义,是一个参考了一个{{SVGElement("color-profile")}} 元素,以及一个或更多颜色成分值。语法如下所示: + + ```plain + icccolor ::= "icc-color(" name (, number)+ ")" + ``` + + \ 对应的 SVG DOM 接口是{{domxref("SVGICCColor")}}。 + +## 整型数 + +- \ + - : 用一个可选的正负符号(“+” 或 “-”)后面跟着一个或多个 0 到 9 的数字可以指定一个\: + + ```plain + integer ::= [+-]? [0-9]+ + ``` + + 如果正负符号不出现,则这个数字是非负的。除非是另有声明为特殊的属性, 的范围是 -2147483648 到 2147483647 之间。在 SVG DOM 内部,一个 代表了一个数字或者一个{{domxref("SVGAnimatedInteger")}}。 + +## IRI + +- \ + - : 一个国际化资源标识符。在因特网上,资源是用 _IRI_(一个国际化资源标识符)标识的。举个例子,一个 SVG 文档调用了位于 http://example.com 上的 someDrawing.svg,可以使用下面的 _IRI_: + + ``` + http://example.com/someDrawing.svg + ``` + + 一个 _IRI_ 中包含一个 _IRI_ 片段标识符,就可以定位一个 XML 文档内部的特定的元素。一个包含有 _IRI_ 片段标识符的 _IRI_,由一个可选的基础 _IRI_ 后面跟着一个“#”号,再跟着一个 _IRI_ 片段标识符组成。举个例子,下面的 IRI 可以用来指定文件 someDrawing.svg 中的 ID 为“Lamppost”的元素: + + ``` + http://example.com/someDrawing.svg#Lamppost + ``` + + _IRI_ 用在 {{SVGAttr("xlink:href")}} 属性中。有些属性既允许 _IRI_ 作为内容,也允许文本字符串。为了消除歧意,避免一个文本字符串被当作 IRI,可以使用功能记号法 \。这只是简单用功能记号法分隔一个 IRI。注意:出于历史原因,为了与 CSS 规范兼容,分隔符是“url(”和“)”。该 _FuncIRI_ 格式用在外观属性中。 + + SVG 广泛地使用了 _IRI_ 引用,引用对象既可以是绝对引用也可以是引对引用。举个例子,要用线性渐变填充一个矩形,你可以先定义一个 {{SVGElement("linearGradient")}} 元素,然后给它一个 ID,如下: + + ```html + ... + ``` + + 然后你再引用这个线性渐变,作为矩形的属性 {{SVGAttr("fill")}} 的值,如下: + + ```html + + ``` + + SVG 支持两种类型的 _IRI_ 引用: + + - 本地 _IRI_ 引用,在这里 IRI 引用不能包含一个 `` 或 ``,因此只能包含一个片段标识符(例如:`` 或者 `#xpointer(id)`)。 + - 非本地 _IRI_ 引用,在这里 _IRI_ 引用必须包含一个 `` 或 ``。 + + 欲了解完整的 SVG 中的 IRI 引用的规范请阅读 [SVG 1.1 (2nd Edition): IRI references](https://www.w3.org/TR/SVG/linking.html#IRIReference)。 + +## 长度 + +- \ + - : 一个长度是一个可度量的距离,给定一个数字以及一个单位。长度可以用两种方法指定。如果在样式表中使用它,可以如下定义\: + + ``` + length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")? + ``` + + 请阅读 [CSS2 规范](https://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#length-units) 以了解单位标识符的意义。 + + 在 CSS2 中定义的长度属性,必须提供单位标识符。而 SVG 专用属性的长度值以及它们对应的外观属性,长度单位标识符是可选的。如果没有提供单位标识符,长度值代表当前用户坐标系统中的一段距离。对于外观属性,无论是定义在 SVG1.1 还是定义在 CSS2 中,长度单位标识符必须是小写的。 + + 如果是在 SVG 属性中使用长度,\需定义如下: + + ``` + length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")? + ``` + + 在这样的 \ 值中,单位标识符必须是小写的。 + + 注意,非属性 \ 定义同样允许百分比单位标识符。这意味着一个百分比长度值依赖于被指定百分比长度值的属性。分两种情况: + + - 百分比长度值表达了一个视口宽度或高度的百分比; + - 百分比长度值表达了一个给定对象上的边界盒的宽度或高度的百分比。 + + 在 SVG DOM 中,\值可以用{{domxref("SVGLength")}}对象或{{domxref("SVGAnimatedLength")}}对象来表达。 + +## *T*值数列 + +- \ + - : (在这里*T* 某些类型。)由一系列分开的值构成的数列。除非另有说明,SVG 的 XML 属性内的数列既可以是逗号分隔的,也可以是空格分隔的。用逗号作分隔符,逗号前面或后面可有带空格。数列中的空白被定义为一个或多个下列连续字符:“空格”(U+0020)、“制表符”(U+0009)、 “换行符”(U+000A)、 “回车符”(U+000D)以及“换页符”(U+000C)。下面是一个 EBNF 语法的模板,用来描述\句法: + + ```plain + list-of-Ts ::= T | T, list-of-Ts + ``` + + 在 SVG DOM 内部,\类型的值可以用一个限特定类型 _T_ 的接口来表达。举个例子,SVG DOM 中的\使用一个 {{domxref("SVGLengthList")}} 对象或者 {{domxref("SVGAnimatedLengthList")}} 对象来表达。 + +## 命名 + +- \ + - : 一个命名,是一个字符串,是不符合句法意义的少量的字符。 + + ```plain + name ::= [^,()#x20#x9#xd#xa] /* 除了 ",", "(", ")" 或 wsp 之外的任何字符 */ + ``` + +## 数字 + +- \ + - : 真实数字可以用两种方法指定。如果用在样式表中,一个 \ 可以如下定义:`plain number ::= integer | [+-]? [0-9]* "." [0-9]+ `该句法与 CSS(CSS2 第 4.3.1 章节)中的定义一样。如果用在一个 SVG 属性中,一个 \ 可以用别的方法定义,允许一个数字后面跟着大数指数,以指定得更精确: + + ```plain + number ::= integer ([Ee] integer)?| [+-]? [0-9]\* "." [0-9]+ ([Ee] integer)? + ``` + + 在 SVG DOM 内部,一个 \ 可以用浮点数、{{domxref("SVGNumber")}} 对象或者 {{domxref("SVGAnimatedNumber")}} 对象来表达。 + +## 带可取舍的后缀数字的数字 + +- \ + - : 一对\,其中第二个 \ 是可视情况取舍的。 + + ```plain + number-optional-number ::= number | number, number + ``` + + 在 SVG DOM 中,一个 \ 可以用一对 {{domxref("SVGAnimatedInteger")}} 对象或者一对 {{domxref("SVGAnimatedNumber")}} 对象来表达。 + +## 不透明度值 + +- \ + - : 颜色不透明度或者当前对象填充的内容的不透明度,它是一个[\](/zh-CN/docs/SVG/Content_type#Number)。任何超出 0.0 到 1.0 范围的值将被压制回这个范围。0.0 表示完全透明,1.0 表示完全不透明。 + +## 涂色 + +- \ + - : 属性{{SVGAttr("fill")}}和属性{{SVGAttr("stroke")}}的值,是涂色类型的规范,用在要对一个给定元素填充或描边的时候。SVG 规范的[Specifying paint](http://www.w3.org/TR/SVG/painting.html#SpecifyingPaint)章节中描述了\可用的选项以及句法。在 SVG DOM 内部,\ 值用{{domxref("SVGPaint")}}对象表达。 + +## 百分数 + +- \ + - : 一个数字后面跟着一个百分号“%”就可以指定一个百分数。 + + ```plain + percentage ::= number "%" + ``` + + 注意 \ 的意义取决于百分数是在一个样式表中指定的,还是在一个 SVG 属性非外观属性中指定的。百分数值总是关联到另一个值。举个例子,每种允许百分比的属性同时定义了引用了给百分比数参考的距离测量。在 SVG DOM 内部,\ 用 {{domxref("SVGNumber")}} 对象或 {{domxref("SVGAnimatedNumber")}} 对象表达。 + +## 时间 + +- \