diff react_games/public/landing_page.js @ 37:fb9bcd3145cb

[ReactGames] Few games I made using react just to practice few things.
author MrJuneJune <me@mrjunejune.com>
date Mon, 01 Dec 2025 20:22:47 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/react_games/public/landing_page.js	Mon Dec 01 20:22:47 2025 -0800
@@ -0,0 +1,26 @@
+const createStars = (x, y) => {
+  const star = document.createElement("div");
+
+  star.style.position = 'fixed';
+  star.style.left = x + 'px';
+  star.style.top = y + 'px';
+  star.style.width = '4px';
+  star.style.height = '4px';
+  star.style.background = 'white';
+  star.style.borderRadius = '50%';
+  star.style.pointerEvents = 'none';
+  star.style.zIndex = '1000';
+  star.style.animation = 'sparkleAnim 1s ease-out forwards';
+
+  document.body.appendChild(star);
+
+  setTimeout(() => {
+    star.remove();
+  }, 1000);
+}
+
+document.addEventListener('mousemove', (e) => {
+  if (Math.random() > 0.99) {
+    createStars(e.clientX, e.clientY);
+  }
+});