aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/animation/id
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/animation/id
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/animation/id')
-rw-r--r--files/zh-cn/web/api/animation/id/index.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/animation/id/index.html b/files/zh-cn/web/api/animation/id/index.html
new file mode 100644
index 0000000000..29e267b854
--- /dev/null
+++ b/files/zh-cn/web/api/animation/id/index.html
@@ -0,0 +1,109 @@
+---
+title: Animation.id
+slug: Web/API/Animation/id
+tags:
+ - 动画
+translation_of: Web/API/Animation/id
+---
+<p>{{ SeeCompatTable() }}{{ APIRef("Web Animations API") }}</p>
+
+<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a> 的 <code><strong>Animation</strong></code><strong><code>.id </code></strong>属性可返回或设置用于识别某个动画的唯一标识.</p>
+
+<h2 id="获取与设置_animation.id">获取与设置 <code>animation.<em>id</em></code></h2>
+
+<div class="syntaxbox">
+<pre class="brush: js">// 获取动画的 id
+var animationsId = animation.<em>id</em>;
+
+// 设置动画的 id
+animation.<em>id</em> = "newId";
+</pre>
+</div>
+
+<h2 id="返回值">返回值</h2>
+
+<p>当该动画已被分配 id, 返回一个 {{domxref("DOMString")}}, 当该动画未被分配 id 则返回 null.</p>
+
+<h2 id="示例">示例</h2>
+
+<p>在 <a href="http://codepen.io/rachelnabors/pen/eJyWzm?editors=0010">Follow the White Rabbit example</a> 这个例子里, 你可以像下面的方式一样,为 <code>rabbitDownAnimation</code> 分配一个 id:</p>
+
+<pre class="brush: js">rabbitDownAnimation.effect.<em>id</em> = "rabbitGo";
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">说明</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Animations', '#dom-animation-id', 'Animation.id' )}}</td>
+ <td>{{Spec2('Web Animations')}}</td>
+ <td>Editor's draft.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器支持">浏览器支持</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome(39.0)}}</td>
+ <td>{{CompatGeckoDesktop(48)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop(48)}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p> </p>
+
+<h2 id="相关文档" style="line-height: 30px; font-size: 2.14285714285714rem;">相关文档</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/KeyframeEffect">KeyframeEffect Interface</a></li>
+ <li><a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a></li>
+ <li>{{domxref("Animation")}}</li>
+</ul>