Slap Ryan in the face, makes satisfying sound.

This commit is contained in:
Ritchie Cunningham 2025-08-23 01:10:15 +01:00
parent 7bfb877284
commit 62c3def856
4 changed files with 69 additions and 0 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
res/
*.jpg
*.png
*.mp3

16
dist/index.html vendored Normal file
View 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
View 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
View 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;
}