Update index.html
Browse files- index.html +2 -8
index.html
CHANGED
@@ -81,7 +81,7 @@
|
|
81 |
let updateBallPosition = () => {
|
82 |
ballY += ballSpeed;
|
83 |
|
84 |
-
// Update ball position
|
85 |
ball.style.top = ballY + "px";
|
86 |
ball.style.left = ballX + "px";
|
87 |
|
@@ -114,13 +114,7 @@
|
|
114 |
};
|
115 |
|
116 |
let resetBall = () => {
|
117 |
-
//
|
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";
|
|
|
81 |
let updateBallPosition = () => {
|
82 |
ballY += ballSpeed;
|
83 |
|
84 |
+
// Update ball position directly with JavaScript
|
85 |
ball.style.top = ballY + "px";
|
86 |
ball.style.left = ballX + "px";
|
87 |
|
|
|
114 |
};
|
115 |
|
116 |
let resetBall = () => {
|
117 |
+
// Reset ball's position to top and random X position
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
ballY = -30; // Reset ball to start position
|
119 |
ballX = Math.floor(Math.random() * (window.innerWidth - 30)); // New random X position
|
120 |
ball.style.top = ballY + "px";
|