Skip to content

Commit 1f3a564

Browse files
changes
1 parent 2dafa89 commit 1f3a564

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

extras/game/script.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@ const reset = async () => {
3030
console.error("Error during storage removal:", error);
3131
}
3232
}
33+
3334
// JavaScript
3435
var clickElement = document.getElementById('click');
3536

36-
clickElement.addEventListener('click', function() {
37-
// Remove the pop class and force a reflow to allow the animation to be restarted mid-animation
38-
this.classList.remove('pop');
39-
void this.offsetWidth;
40-
this.classList.add('pop');
37+
clickElement.addEventListener('mousedown', function() {
38+
this.classList.add('scale-down');
39+
});
40+
41+
clickElement.addEventListener('mouseup', function() {
42+
this.classList.remove('scale-down');
43+
});
44+
clickElement.addEventListener('mouseleave', function() {
45+
this.classList.remove('scale-down');
4146
});
4247

4348
run();

extras/game/style.css

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ body {
2828
cursor: pointer;
2929
height: auto;
3030
width: auto;
31+
transition: all 0.1s ease-in-out;
3132
}
3233

3334
.text-layer{
@@ -51,12 +52,6 @@ body {
5152
}
5253

5354
/* CSS */
54-
.pop {
55-
animation: pop 0.3s;
56-
}
57-
58-
@keyframes pop {
59-
0% { transform: scale(1); }
60-
50% { transform: scale(1.2); }
61-
100% { transform: scale(1); }
55+
.scale-down {
56+
transform: scale(0.8);
6257
}

0 commit comments

Comments
 (0)