const shakeScreen = (time: number = 250) => { const shakeX = Math.random() * 20 + 5; const shakeY = Math.random() * 5 + 1; // Apply these values as CSS variables document.body.style.setProperty('--shake-x', `${shakeX}px`); document.body.style.setProperty('--shake-y', `${shakeY}px`); // Add the shake class document.body.classList.add('screen-shake'); // Remove the shake class after animation ends setTimeout(() => { document.body.classList.remove('screen-shake'); }, time); }; export default shakeScreen;