requestAnimationFrame()Baseline · Widely available
The requestAnimationFrame() method schedules a function that runs before the next repaint. You can use it to animate content with JavaScript.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 29, 2015. Widely available since Jan 29, 2018.
Browser support
DesktopChrome
1–23Not supported
24+Supportedsince Jan 10, 2013
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–22Not supported
23+Supportedsince Aug 6, 2013
Current: 157Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27MobileChrome Android
18–18Not supported
25+Supportedsince Feb 27, 2013
Current: 155Firefox Android
4–22Not supported
23+Supportedsince Aug 6, 2013
Current: 157Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: cancelAnimationFrame.
Feature detection
JS · check before using
if ("Window" in globalThis && "requestAnimationFrame" in Window.prototype) {
// Window.requestAnimationFrame is available
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Window.cancelAnimationFrame | 24 | 12 | 23 | 7 | 25 | 23 | 7 |
| Window.requestAnimationFrame | 24 | 12 | 23 | 7 | 25 | 23 | 7 |