aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/cancelanimationframe/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/window/cancelanimationframe/index.html')
-rw-r--r--files/zh-cn/web/api/window/cancelanimationframe/index.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/cancelanimationframe/index.html b/files/zh-cn/web/api/window/cancelanimationframe/index.html
new file mode 100644
index 0000000000..0d98e5db24
--- /dev/null
+++ b/files/zh-cn/web/api/window/cancelanimationframe/index.html
@@ -0,0 +1,117 @@
+---
+title: window.cancelAnimationFrame
+slug: Web/API/Window/cancelAnimationFrame
+translation_of: Web/API/Window/cancelAnimationFrame
+---
+<div>{{APIRef}}{{SeeCompatTable}}</div>
+
+<h2 id="概述">概述</h2>
+
+<p>取消一个先前通过调用{{ domxref("window.requestAnimationFrame()") }}方法添加到计划中的动画帧请求.</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="eval">window.mozCancelAnimationFrame(<em>requestID</em>); // Firefox
+</pre>
+
+<h2 id="参数">参数</h2>
+
+<dl>
+ <dt><code>requestID</code></dt>
+ <dd>先前调用{{ domxref("window.requestAnimationFrame()") }}方法时返回的ID.</dd>
+</dl>
+
+<h2 id="Notes" name="Notes">示例</h2>
+
+<pre class="deki-transform">var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
+                            window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
+
+var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
+
+var start = window.mozAnimationStartTime;  // 只有Firefox支持mozAnimationStartTime属性,其他浏览器可以使用Date.now()来替代.
+
+var myReq;
+function step(timestamp) {
+  var progress = timestamp - start;
+  d.style.left = Math.min(progress/10, 200) + "px";
+  if (progress &lt; 2000) {
+    myReq = requestAnimationFrame(step);
+  }
+}
+myReq = requestAnimationFrame(step);
+
+window.cancelAnimationFrame(myReq);
+</pre>
+
+<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<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>
+ <p>21.0 {{ property_prefix("webkit") }}</p>
+
+ <p>24.0 脱前缀</p>
+ </td>
+ <td>
+ <p>{{ CompatGeckoDesktop("11.0") }} {{ property_prefix("moz") }} </p>
+ </td>
+ <td>10</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>
+ <p>6.0 {{ property_prefix("webkit") }}</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for 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>{{ CompatUnknown() }}</td>
+ <td>
+ <p>{{ CompatUnknown() }}</p>
+ </td>
+ <td>{{ CompatGeckoMobile("11.0") }} {{ property_prefix("moz") }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<p>{{ spec("http://www.w3.org/TR/animation-timing/#cancelAnimationFrame", "Timing control for script-based animations: cancelAnimationFrame", "WD") }}</p>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>{{ domxref("window.mozAnimationStartTime") }}</li>
+ <li>{{ domxref("window.requestAnimationFrame()") }}</li>
+</ul>