Why is this bouncing saucer stuck in a frozen state?
const saucer = document.querySelector("#saucer");
const bounds = { min: 20, max: 420 };
let posX = 30;
let speed = 4;
let isDescending = false;
function updateSaucer() {
posX += speed;
if (posX >= bounds.max || posX <= bounds.min) {
speed = -speed;
isDescending = !isDescending;
}
const wobble = Math.sin(posX * 0.05) * 8;
saucer.style.left = posX;
saucer.style.top = `${80 + wobble}px`;
saucer.style.transform = `rotate(${speed * 3}deg)`;
requestAnimationFrame(updateSaucer);
}
requestAnimationFrame(updateSaucer);
Reply with what is broken and how you would fix it.