view react_games/public/landing_page.js @ 48:46daba6e3cf4

Few python scrtips to show how to use asychio.
author MrJuneJune <me@mrjunejune.com>
date Sat, 13 Dec 2025 14:23:02 -0800
parents fb9bcd3145cb
children
line wrap: on
line source

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);
  }
});