From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/animation/id/index.html | 109 ++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 files/zh-cn/web/api/animation/id/index.html (limited to 'files/zh-cn/web/api/animation/id') 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 +--- +

{{ SeeCompatTable() }}{{ APIRef("Web Animations API") }}

+ +

Web Animations API 的 Animation.id 属性可返回或设置用于识别某个动画的唯一标识.

+ +

获取与设置 animation.id

+ +
+
// 获取动画的 id
+var animationsId = animation.id;
+
+// 设置动画的 id
+animation.id = "newId";
+
+
+ +

返回值

+ +

当该动画已被分配 id, 返回一个 {{domxref("DOMString")}}, 当该动画未被分配 id 则返回 null.

+ +

示例

+ +

Follow the White Rabbit example 这个例子里, 你可以像下面的方式一样,为 rabbitDownAnimation 分配一个 id:

+ +
rabbitDownAnimation.effect.id = "rabbitGo";
+
+ +

规范

+ + + + + + + + + + + + + + +
规范状态说明
{{SpecName('Web Animations', '#dom-animation-id', 'Animation.id' )}}{{Spec2('Web Animations')}}Editor's draft.
+ +

浏览器支持

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(39.0)}}{{CompatGeckoDesktop(48)}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop(48)}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +

 

+ +

相关文档

+ + -- cgit v1.2.3-54-g00ecf