GarGerry commited on
Commit
a74ce5a
·
verified ·
1 Parent(s): a7c28a1

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +7 -0
index.html CHANGED
@@ -114,6 +114,13 @@
114
  };
115
 
116
  let resetBall = () => {
 
 
 
 
 
 
 
117
  ballY = -30; // Reset ball to start position
118
  ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
119
  ball.style.top = ballY + "px";
 
114
  };
115
 
116
  let resetBall = () => {
117
+ // Stop the animation immediately when resetting the ball
118
+ ball.style.animation = 'none';
119
+ setTimeout(() => {
120
+ // Restart the animation after a small delay
121
+ ball.style.animation = `fall ${fallSpeed}s linear infinite`;
122
+ }, 50); // Delay to restart the animation
123
+
124
  ballY = -30; // Reset ball to start position
125
  ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
126
  ball.style.top = ballY + "px";