OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-
scale=1.0"> |
| 5 <title>requestAnimationFrame Test</title> |
| 6 <style type="text/css"> |
| 7 html, body { |
| 8 height: 100%; |
| 9 padding: 0px; |
| 10 margin: 0px; |
| 11 } |
| 12 #container { |
| 13 width: 100%; |
| 14 height: 100%; |
| 15 background: rgb(128, 128, 128); |
| 16 } |
| 17 </style> |
| 18 </head> |
| 19 <body> |
| 20 <div id="container"></div> |
| 21 <script type="text/javascript"> |
| 22 var container = document.getElementById('container'); |
| 23 var c = 128; |
| 24 tick(); |
| 25 function tick() { |
| 26 ++c; |
| 27 c %= 256; |
| 28 container.style.backgroundColor = "rgb("+c+","+c+","+c+")"; |
| 29 requestAnimationFrame(tick); |
| 30 }; |
| 31 </script> |
| 32 </body> |
| 33 </html> |
OLD | NEW |