window.cancelAnimationFrame()
Experimental
Esta es una tecnología experimental
Comprueba la Tabla de compabilidad de navegadores cuidadosamente antes de usarla en producción.
Resumen
Cancela la petición de animación previamente programada a través de window.requestAnimationFrame()
.
Sintaxis
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.
Parámetros
ID de la petición
- El valor del ID regresado por la llamada a
window.requestAnimationFrame()
que solicitó una llamada de vuelta.
Ejemplos
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);
Compatibilidad de navegadores
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Característica | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Soporte básico | 21.0 webkit (en-US) 24.0 |
11.0 (11.0) moz (en-US) 23.0 |
10 | 15.0 | 6.0 webkit (en-US) 6.1 |
Característica | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Soporte básico | 4.4 | 33 | 11.0 (11.0) moz (en-US) 23.0 |
10 | 33 | 7.1 |