Mercurial
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 36:84672efec192 | 37:fb9bcd3145cb |
|---|---|
| 1 const createStars = (x, y) => { | |
| 2 const star = document.createElement("div"); | |
| 3 | |
| 4 star.style.position = 'fixed'; | |
| 5 star.style.left = x + 'px'; | |
| 6 star.style.top = y + 'px'; | |
| 7 star.style.width = '4px'; | |
| 8 star.style.height = '4px'; | |
| 9 star.style.background = 'white'; | |
| 10 star.style.borderRadius = '50%'; | |
| 11 star.style.pointerEvents = 'none'; | |
| 12 star.style.zIndex = '1000'; | |
| 13 star.style.animation = 'sparkleAnim 1s ease-out forwards'; | |
| 14 | |
| 15 document.body.appendChild(star); | |
| 16 | |
| 17 setTimeout(() => { | |
| 18 star.remove(); | |
| 19 }, 1000); | |
| 20 } | |
| 21 | |
| 22 document.addEventListener('mousemove', (e) => { | |
| 23 if (Math.random() > 0.99) { | |
| 24 createStars(e.clientX, e.clientY); | |
| 25 } | |
| 26 }); |