Hey there! I'm having some trouble moving figures while moving the cursor. It's strange because I've done the same thing on another page and it worked perfectly:
const scaleFactor = 1 / 20;
function moveItems(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)
}
moveItems()
I've tried different approaches to fix it, but the issue persists