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/cancel/index.html | 112 ++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 files/zh-cn/web/api/animation/cancel/index.html (limited to 'files/zh-cn/web/api/animation/cancel') diff --git a/files/zh-cn/web/api/animation/cancel/index.html b/files/zh-cn/web/api/animation/cancel/index.html new file mode 100644 index 0000000000..768e63f5fe --- /dev/null +++ b/files/zh-cn/web/api/animation/cancel/index.html @@ -0,0 +1,112 @@ +--- +title: Animation.cancel() +slug: Web/API/Animation/cancel +tags: + - Animation.cancel() +translation_of: Web/API/Animation/cancel +--- +

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

+ +

{{domxref("Animation")}} 接口的 Web动画API的 cancel() 方法将清除此动画造成的所有{{domxref("KeyframeEffect")}} ,并中止其播放。.

+ +
+

当一个动画被取消时,其  {{domxref("Animation.startTime", "startTime")}}  和{{domxref("Animation.currentTime", "currentTime")}} 被设置为null。

+
+ +

语法

+ +
Animation.cancel();
+ +

参数

+ +

无.

+ +

返回值

+ +

无.

+ +

异常

+ +

这个方法不会直接抛出异常; 但是,如果动画的 {{domxref("Animation.playState", "playState")}} 取消时是除了“空闲”之外的任何东西,{{domxref("Animation.finished", "current finished promise", "", 1)}} 被拒绝与一个 {{domxref("DOMException")}} 命名的AbortError.

+ +
+
+ +

规范

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Web Animations', '#dom-animation-cancel', 'Animation.cancel()' )}}{{Spec2('Web Animations')}}Editor's draft.
+ +

浏览器兼容

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

[1] The Web Animations API is only enabled by default in Firefox Developer Edition and Nightly builds. You can enable it in beta and release builds by setting the preference dom.animations-api.core.enabled to true, and can disable it in any Firefox version by setting this preference to false.

+ +

相关内容

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