aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/fill/index.html
blob: 1367e0ee8a2ec6a7f90e3e4aaee0d217148a1c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: fill
slug: Web/SVG/Attribute/fill
tags:
  - SVG
  - SVG属性
  - 需要兼容性表
translation_of: Web/SVG/Attribute/fill
---
<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG属性参考主页</a></p>

<p><code>fill</code>属性根据它的使用环境,拥有两个意义。</p>

<p><span style="line-height: 22.008px;">默认地,当动画元素结束时,目标元素的外观属性不再应用该效果。在动画元素结束后,要还保持这个动画的的值,就需要用到<code>fill</code>属性。</span></p>

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

<h2 id="用法">用法</h2>

<h3 id="对动画元素">对动画元素</h3>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">类别</th>
   <td>动画定时属性</td>
  </tr>
  <tr>
   <th scope="row"></th>
   <td><strong title="this is the default value">remove</strong> | freeze</td>
  </tr>
  <tr>
   <th scope="row">可变性</th>
   <td>No</td>
  </tr>
  <tr>
   <th scope="row">规范文档</th>
   <td><a class="external" href="http://www.w3.org/TR/SVG/animate.html#FillAttribute" title="http://www.w3.org/TR/SVG/animate.html#FillAttribute">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<dl>
 <dt>remove(默认值)</dt>
 <dd>在动画的激活持续时间结束后,动画效果会移除(不再应用)。在动画的激活结束后,动画不再对目标元素有影响(除非动画重新开始)。</dd>
 <dt>freeze</dt>
 <dd>在动画激活持续时间结束后,文档持续时间的剩余时间里(或者直到动画重新开始)动画效果会“冻结”着。</dd>
</dl>

<h3 id="对形状元素">对形状元素</h3>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">类别</th>
   <td>外观属性</td>
  </tr>
  <tr>
   <th scope="row"></th>
   <td><a href="/en/SVG/Content_type#Paint" title="en/SVG/Content_type#Paint">&lt;paint&gt;</a></td>
  </tr>
  <tr>
   <th scope="row">可变性</th>
   <td>Yes</td>
  </tr>
  <tr>
   <th scope="row">规范文档</th>
   <td><a class="external" href="http://www.w3.org/TR/SVG/painting.html#FillProperty" title="http://www.w3.org/TR/SVG/painting.html#FillProperty">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="示例">示例</h2>

<h2 id="元素">元素</h2>

<p>下列元素可以使用<code>fill</code>属性:</p>

<ul>
 <li><a href="/en/SVG/Element#Animation_elements" title="en/SVG/Element#Animation">动画元素</a> »</li>
 <li><a href="/en/SVG/Element#Shape" title="en/SVG/Element#Shape">形状元素</a> »</li>
 <li><a href="/en/SVG/Element#TextContent" title="en/SVG/Element#TextContent">文本内容元素</a> »</li>
</ul>