aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/window/cancelanimationframe/index.html
blob: eae485c315735dd7ddcfa1607babe611e2d48dda (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
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 &lt; 2000) {
    myReq = requestAnimationFrame(step);
  }
}
myReq = requestAnimationFrame(step);

window.cancelAnimationFrame(myReq);
</pre>

<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilidad de navegadores</h2>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Soporte básico</td>
   <td>21.0 {{property_prefix("webkit")}}<br>
    24.0</td>
   <td>{{CompatGeckoDesktop("11.0")}} {{property_prefix("moz")}}<br>
    23.0</td>
   <td>10</td>
   <td>15.0</td>
   <td>6.0 {{property_prefix("webkit")}}<br>
    6.1</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Característica</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>Soporte básico</td>
   <td>4.4</td>
   <td>33</td>
   <td>{{CompatGeckoMobile("11.0")}} {{property_prefix("moz")}}<br>
    23.0</td>
   <td>10</td>
   <td>33</td>
   <td>7.1</td>
  </tr>
 </tbody>
</table>
</div>

<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>