Update index.html
Browse files- index.html +6 -0
index.html
CHANGED
@@ -117,6 +117,12 @@
|
|
117 |
};
|
118 |
|
119 |
let resetBall = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
ballY = -30; // Reset ball to start position
|
121 |
ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
|
122 |
ball.style.top = ballY + "px";
|
|
|
117 |
};
|
118 |
|
119 |
let resetBall = () => {
|
120 |
+
// Stop the animation when ball is reset
|
121 |
+
ball.style.animation = 'none';
|
122 |
+
setTimeout(() => {
|
123 |
+
ball.style.animation = `fall ${fallSpeed}s linear infinite`;
|
124 |
+
}, 50); // Delay to restart the animation
|
125 |
+
|
126 |
ballY = -30; // Reset ball to start position
|
127 |
ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
|
128 |
ball.style.top = ballY + "px";
|