Created
April 30, 2022 20:02
-
-
Save endymion1818/26fd541dbb74ea4e2453654a01a770ba to your computer and use it in GitHub Desktop.
do a barrel roll invoke via spacebar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var styles = document.createElement("style"); | |
styles.innerHTML = "@-moz-keyframes roll{100%{-moz-transform:rotate(360deg)}}@-o-keyframes roll{100%{-o-transform:rotate(360deg)}}@-webkit-keyframes roll{100%{-webkit-transform:rotate(360deg)}}.do-a-barrel-roll{-moz-animation-duration:2s;-moz-animation-name:roll;-moz-animation-iteration-count:1;-webkit-animation-duration:2s;-webkit-animation-name:roll;-webkit-animation-iteration-count:1;-o-animation-duration:2s;-o-animation-name:roll;-o-animation-iteration-count:1}"; | |
document.getElementsByTagName("body")[0].appendChild(styles); | |
var interval; | |
var keyed = ""; | |
document.addEventListener("keypress", function(event) { | |
if (event.charCode === 32) { | |
keyed = ""; | |
document.body.classList.add("do-a-barrel-roll"); | |
setTimeout(function() { | |
document.body.classList.remove("do-a-barrel-roll"); | |
}, 2000); | |
} | |
clearInterval(interval); | |
interval = setInterval(function(){ | |
keyed = ""; | |
}, 5000); | |
keyed += String.fromCharCode(event.charCode); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment