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
if you're not mon, don't read any further, it's pretty bad JS
Performance in chrome
Loading screen
Volume controls
Prettier ui
@ -23,7 +24,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="style.css">
<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">
<animate attributeName="stdDeviation" attributeType="XML"
begin="indefinite" end="indefinite" dur="0.1s"
@ -165,8 +166,7 @@
}
function timerLoop() {
// 60fps-ish
setTimeout(timerLoop, 16);
window.requestAnimationFrame(timerLoop);
if(!audio.current_song || !audio.current_song._playing) {
return;
}
@ -179,7 +179,8 @@
}
function animationLoop() {
setTimeout(animationLoop, animationLoopTime);
requestAnimationFrame(animationLoop);
//setTimeout(animationLoop, animationLoopTime);
var cur = audio.current_song;
if(!cur || !cur._playing)
return;

Loading…
Cancel
Save