Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2012 04:18
Show Gist options
  • Save anonymous/4385464 to your computer and use it in GitHub Desktop.
Save anonymous/4385464 to your computer and use it in GitHub Desktop.
// requires jquery, buzz.js
$(document).ready(function() {
var mySound = new buzz.sound( "/sounds/teen-liver", {
formats: [ "ogg", "mp3", "acc", "wav" ]
});
var mySound2 = new buzz.sound( "/sounds/teen-liver", {
formats: [ "ogg", "mp3", "acc", "wav" ]
});
$('html').keyup(function (e) {
// left
if (e.keyCode == 37) {
$('html').css('background-color', 'green');
$('#makey_output').html('<h1>left</h1>');
mySound.play()
.fadeIn()
.loop()
.bind( "timeupdate", function() {
var timer = buzz.toTimer( this.getTime() );
document.getElementById( "timer" ).innerHTML = timer;
});
// right
} if (e.keyCode == 39) {
$('html').css('background-color', 'black');
// alert('Right');
$('#makey_output').html('<h1>right</h1>');
mySound.pause();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment