cleanup
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
AFRAME.registerComponent('debug-states', {
|
||||
schema: {
|
||||
isPlaying: {default: false},
|
||||
isPaused: {default: false},
|
||||
isGameOver: {default: false}
|
||||
},
|
||||
update: function(){
|
||||
document.getElementById('debugIsGameOver').className = this.data.isGameOver ? 'active': '';
|
||||
document.getElementById('debugIsPaused').className = this.data.isPaused ? 'active': '';
|
||||
document.getElementById('debugIsPlaying').className = this.data.isPlaying ? 'active': '';
|
||||
console.log(`%c gameover: ${this.data.isGameOver}, paused: ${this.data.isPaused}, playing: ${this.data.isPlaying}`, 'background: #222; color: #bada55');
|
||||
}
|
||||
});
|
||||
@@ -20,7 +20,6 @@ AFRAME.registerComponent('pauser', {
|
||||
events.forEach(event => {
|
||||
this.el.addEventListener(event, this.pauseGame);
|
||||
});
|
||||
document.addEventListener('keydown', this.pauseGame);
|
||||
},
|
||||
|
||||
pauseGame: function () {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<style type="text/css">
|
||||
#debugStates{
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
margin: 0.3rem;
|
||||
font: 14px sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
#debugStates span{
|
||||
display: inline-block;
|
||||
padding: 1rem;
|
||||
margin: 0.3rem;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
}
|
||||
#debugStates span.active{
|
||||
background: #5af;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<div id="debugStates">
|
||||
<span id="debugIsGameOver">isGameOver</span>
|
||||
<span id="debugIsPaused">isPaused</span>
|
||||
<span id="debugIsPlaying">isPlaying</span>
|
||||
</div>
|
||||
33
test.html
33
test.html
@@ -1,33 +0,0 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user