mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:12:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			513 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			513 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html>
 | |
| <head><title>rAF test</title></head>
 | |
| <body>
 | |
| <canvas id=c width=300 height=300></canvas>
 | |
| <script>
 | |
| c = document.getElementById('c');
 | |
| x = c.getContext("2d");
 | |
| x.fillStyle = 'black';
 | |
| x.fillRect(0, 0, c.width, c.height);
 | |
| function raf() {
 | |
|     x.fillStyle = 'red';
 | |
|     x.fillRect(
 | |
|         Math.random() * c.width,
 | |
|         Math.random() * c.height,
 | |
|         Math.random() * 10,
 | |
|         Math.random() * 10
 | |
|     );
 | |
|     requestAnimationFrame(raf);
 | |
| }
 | |
| requestAnimationFrame(raf);
 | |
| </script>
 | |
| </body>
 | |
| </html>
 | 
