Use requestAnimationFrame

serial
William Toohey 10 years ago
parent d3ee953bfd
commit 0c28b13314
  1. 9
      index.html

@ -5,6 +5,7 @@
Clean up the damn code Clean up the damn code
if you're not mon, don't read any further, it's pretty bad JS if you're not mon, don't read any further, it's pretty bad JS
Performance in chrome
Loading screen Loading screen
Volume controls Volume controls
Prettier ui Prettier ui
@ -23,7 +24,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" height="0"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" height="0">
<filter id="blur" filterRes="1"> <filter id="blur">
<feGaussianBlur stdDeviation="0 0"> <feGaussianBlur stdDeviation="0 0">
<animate attributeName="stdDeviation" attributeType="XML" <animate attributeName="stdDeviation" attributeType="XML"
begin="indefinite" end="indefinite" dur="0.1s" begin="indefinite" end="indefinite" dur="0.1s"
@ -165,8 +166,7 @@
} }
function timerLoop() { function timerLoop() {
// 60fps-ish window.requestAnimationFrame(timerLoop);
setTimeout(timerLoop, 16);
if(!audio.current_song || !audio.current_song._playing) { if(!audio.current_song || !audio.current_song._playing) {
return; return;
} }
@ -179,7 +179,8 @@
} }
function animationLoop() { function animationLoop() {
setTimeout(animationLoop, animationLoopTime); requestAnimationFrame(animationLoop);
//setTimeout(animationLoop, animationLoopTime);
var cur = audio.current_song; var cur = audio.current_song;
if(!cur || !cur._playing) if(!cur || !cur._playing)
return; return;

Loading…
Cancel
Save