game over slow down fx (fixes #39)

This commit is contained in:
Diego F. Goberna
2018-10-09 21:36:35 +02:00
parent f9604ace05
commit b7e36bf760
13 changed files with 198 additions and 9 deletions

33
test.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
let audio = document.createElement('audio');
audio.crossOrigin = 'anonymous';
audio.setAttribute('src', "https://s3-us-west-2.amazonaws.com/supersaber/106-song.ogg");
// var ctx = new AudioContext();
// var audioSrc = ctx.createMediaElementSource(audio);
// var analyser = ctx.createAnalyser();
// audioSrc.connect(analyser);
// var frequencyData = new Uint8Array(analyser.frequencyBinCount);
// analyser.getByteFrequencyData(frequencyData);
var r = 1;
var v = 1;
audio.play();
setTimeout(rate, 100);
function rate(){
if (r < 0.5) return;
r -= 0.01;
v -= 0.02;
audio.playbackRate = r;
audio.volume = Math.max(0, v);
setTimeout(rate, 100);
}
</script>
</body>
</html>