blob: 27420acde129d25d7e3555aa3112f313094d5d44 (
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
|
---
title: window.cancelAnimationFrame()
slug: Web/API/Window/cancelAnimationFrame
translation_of: Web/API/Window/cancelAnimationFrame
---
<div>{{APIRef}}{{SeeCompatTable}}</div>
<h2 id="Summary" name="Summary">Resumen</h2>
<p>Cancela la petición de animación previamente programada a través de {{domxref("window.requestAnimationFrame()")}}.</p>
<h2 id="Syntax" name="Syntax">Sintaxis</h2>
<pre class="syntaxbox">window.cancelAnimationFrame(<em>requestID</em>);
</pre>
<div class="note">
<p><strong>Nota:</strong> Antes de Firefox 23, la función es independiente del proveedor con el prefijo <code>window.mozCancelAnimationFrame()</code>. Consulte la tabla de compatibilidad, a continuación, para otras implementaciones de navegador.</p>
</div>
<h3 id="Parameters" name="Parameters">Parámetros</h3>
<dl>
<dt><code>ID de la petición</code></dt>
<dd>El valor del ID regresado por la llamada a {{domxref("window.requestAnimationFrame()")}} que solicitó una llamada de vuelta.</dd>
</dl>
<h2 id="Examples" name="Examples">Ejemplos</h2>
<pre class="brush: js">var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
var start = window.mozAnimationStartTime; // Only supported in FF. Other browsers can use something like Date.now().
var myReq;
function step(timestamp) {
var progress = timestamp - start;
d.style.left = Math.min(progress/10, 200) + "px";
if (progress < 2000) {
myReq = requestAnimationFrame(step);
}
}
myReq = requestAnimationFrame(step);
window.cancelAnimationFrame(myReq);
</pre>
<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilidad de navegadores</h2>
{{Compat("api.Window.cancelAnimationFrame")}}
<h2 id="Specification" name="Specification">Especificación</h2>
<ul>
<li>{{spec("http://www.w3.org/TR/animation-timing/#cancelAnimationFrame", "Timing control for script-based animations: cancelAnimationFrame", "WD")}}</li>
</ul>
<h2 id="Ver_también">Ver también</h2>
<ul>
<li>{{domxref("window.mozAnimationStartTime")}}</li>
<li>{{domxref("window.requestAnimationFrame()")}}</li>
</ul>
|