Created
April 6, 2023 14:54
-
-
Save carlosazaustre/7c10ad82321df7a8a9364cbd45198927 to your computer and use it in GitHub Desktop.
Doge.js
This file contains 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
const logo = document.getElementById("logo"); | |
let currentIndex = 0; | |
const keySequence = [ | |
"ArrowUp", | |
"ArrowUp", | |
"ArrowDown", | |
"ArrowDown", | |
"ArrowLeft", | |
"ArrowRight", | |
"ArrowLeft", | |
"ArrowRight", | |
"KeyB", | |
"KeyA", | |
]; | |
document.addEventListener("keydown", (event) => { | |
if (event.code === keySequence[currentIndex]) { | |
currentIndex++; | |
if (currentIndex === keySequence.length) { | |
logo.style.transform = "rotate(360deg)"; | |
currentIndex = 0; | |
} | |
} else { | |
currentIndex = 0; | |
} | |
}); |
This file contains 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
<!DOCTYPE html> | |
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Doge.js</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<img src="./logo.png" alt="logo" id="logo" /> | |
</div> | |
<script src="./app.js"></script> | |
</body> | |
</html> |
This file contains 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
body { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
min-height: 100vh; | |
margin: 0; | |
background-color: #f0f0f0; | |
} | |
.container { | |
position: relative; | |
} | |
#logo { | |
width: 300px; | |
height: auto; | |
transition: transform 1s ease; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment