--- title: window.cancelAnimationFrame() slug: Web/API/Window/cancelAnimationFrame translation_of: Web/API/Window/cancelAnimationFrame ---
Cancela la petición de animación previamente programada a través de {{domxref("window.requestAnimationFrame()")}}.
window.cancelAnimationFrame(requestID);
Nota: Antes de Firefox 23, la función es independiente del proveedor con el prefijo window.mozCancelAnimationFrame()
. Consulte la tabla de compatibilidad, a continuación, para otras implementaciones de navegador.
ID de la petición
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);
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Soporte básico | 21.0 {{property_prefix("webkit")}} 24.0 |
{{CompatGeckoDesktop("11.0")}} {{property_prefix("moz")}} 23.0 |
10 | 15.0 | 6.0 {{property_prefix("webkit")}} 6.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | 4.4 | 33 | {{CompatGeckoMobile("11.0")}} {{property_prefix("moz")}} 23.0 |
10 | 33 | 7.1 |