Good morning! Im trying to move some figures while im moving the cursor, i dont know why this is not working since I did the same on other page and it works:
const scaleFactor = 1 / 20;
function movebackground(event) {
const shapes = document.querySelectorAll(".shape")
const x = event.clientX * scaleFactor;
const y = event.clientY * scaleFactor;
for (let i = 0; i < shapes.length; ++i) {
const isOdd= i % 2 !== 0;
const boolInt = isOdd ? -1: 1;
shapes[i].style.transform = `translate(${x * boolInt}px, ${y * boolInt}px)`
}
console.log(shapes)
}
movebackground()
I tried another ways to solve it but still with the same issue