Slap Ryan in the face, makes satisfying sound.
This commit is contained in:
parent
7bfb877284
commit
62c3def856
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,4 @@
|
||||
res/
|
||||
*.jpg
|
||||
*.png
|
||||
*.mp3
|
||||
|
16
dist/index.html
vendored
Normal file
16
dist/index.html
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>F.ck Ryan</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="slap-container">
|
||||
<img src="ryan.jpg" alt="Slap Me" id="slap-image">
|
||||
</div>
|
||||
<audio id="slap-sound" src="slap.mp3" preload="auto"></audio>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
17
dist/script.js
vendored
Normal file
17
dist/script.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
const slapContainer = document.getElementById('slap-container');
|
||||
const slapSound = document.getElementById('slap-sound');
|
||||
|
||||
slapContainer.addEventListener('mousedown', () => {
|
||||
const emoji = document.createElement('span');
|
||||
emoji.classList.add('slap-emoji');
|
||||
emoji.textContent = '👋🏿';
|
||||
slapContainer.appendChild(emoji);
|
||||
slapContainer.classList.add('slapped');
|
||||
slapSound.currentTime = 0;
|
||||
slapSound.play();
|
||||
|
||||
setTimeout(() => {
|
||||
slapContainer.classList.remove('slapped');
|
||||
emoji.remove();
|
||||
}, 200);
|
||||
});
|
33
dist/style.css
vendored
Normal file
33
dist/style.css
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
background-color: #121212;
|
||||
}
|
||||
|
||||
#slap-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#slap-image {
|
||||
width: 400px;
|
||||
height: auto;
|
||||
border: 2px solid #f0f0f0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.slap-emoji {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 100px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-out;
|
||||
}
|
||||
|
||||
#slap-container.slapped .slap-emoji {
|
||||
opacity: 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user