mirror of
				https://codeberg.org/ashley/poke
				synced 2025-07-17 16:52:11 +00:00 
			
		
		
		
	use 30fps (should help #65)
This commit is contained in:
		
							parent
							
								
									09aab0784a
								
							
						
					
					
						commit
						866e0b853d
					
				| @ -1823,7 +1823,7 @@ if (/[?&]autoplay=/.test(location.search)) { | ||||
| } | ||||
|  <% } %> | ||||
|    | ||||
| 
 | ||||
|   | ||||
| </script> | ||||
|      <script> | ||||
| 	const languageCode = localStorage.getItem("Language"); | ||||
| @ -1890,10 +1890,19 @@ if (/[?&]autoplay=/.test(location.search)) { | ||||
| 
 | ||||
| <script> | ||||
| let requestId; | ||||
| let lastDrawTime = 0; // Timestamp of the last draw request | ||||
| 
 | ||||
| const loopStart = () => { | ||||
|   requestId = window.requestAnimationFrame(loopStart) | ||||
| } | ||||
|   const now = performance.now(); | ||||
|   const elapsed = now - lastDrawTime; | ||||
|   if (elapsed >= (1000 / 30)) { // Adjusted for milliseconds | ||||
|     lastDrawTime = now; | ||||
|     draw(); | ||||
|   } | ||||
| 
 | ||||
|   // Continue loop using requestAnimationFrame | ||||
|   requestId = window.requestAnimationFrame(loopStart); | ||||
| }; | ||||
| 
 | ||||
| const loopCancel = () => { | ||||
|   window.cancelAnimationFrame(requestId) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ashley ////
						Ashley ////