| <html> |
| <script> |
| window.rafCount = 0; |
| function animationCallback() { |
| ++window.rafCount; |
| console.log(`Animation frame callback #${window.rafCount}`); |
| // Change document body background in a predictable manner. |
| document.body.style.background = '#0000' + (window.rafCount * 10).toString(16); |
| window.requestAnimationFrame(animationCallback); |
| } |
| |
| function startRAF() { |
| console.log('Requesting first animation frame'); |
| window.requestAnimationFrame(animationCallback); |
| } |
| |
| function displayRAFCount() { |
| console.log(`Animation frame count: ${window.rafCount}`); |
| } |
| </script> |
| <body></body> |
| </html> |