GarGerry commited on
Commit
53e2177
·
verified ·
1 Parent(s): 5f58408

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +11 -1
index.html CHANGED
@@ -30,6 +30,7 @@
30
 
31
  // Random horizontal position for the ball
32
  ball.style.left = `${Math.random() * (window.innerWidth - 30)}px`;
 
33
  document.body.appendChild(ball);
34
 
35
  let ballFallInterval = setInterval(() => {
@@ -66,4 +67,13 @@
66
  createBall();
67
 
68
  // Move the platform with mouse and touch events
69
- const platform =
 
 
 
 
 
 
 
 
 
 
30
 
31
  // Random horizontal position for the ball
32
  ball.style.left = `${Math.random() * (window.innerWidth - 30)}px`;
33
+ ball.style.top = '-30px'; // Start above the screen
34
  document.body.appendChild(ball);
35
 
36
  let ballFallInterval = setInterval(() => {
 
67
  createBall();
68
 
69
  // Move the platform with mouse and touch events
70
+ const platform = document.querySelector('.platform');
71
+ document.addEventListener('mousemove', (e) => {
72
+ platform.style.left = `${e.pageX - platform.offsetWidth / 2}px`;
73
+ });
74
+ document.addEventListener('touchmove', (e) => {
75
+ platform.style.left = `${e.touches[0].pageX - platform.offsetWidth / 2}px`;
76
+ });
77
+ </script>
78
+ </body>
79
+ </html>