motion effect
// Get the HTML element you want to apply the motion effect to
const element = document.querySelector(‘.motion-element’);
// Listen for mouse movements on the document
document.addEventListener(‘mousemove’, (event) => {
// Calculate the horizontal and vertical mouse position relative to the center of the element
const xPos = (event.clientX – (element.offsetLeft + element.offsetWidth / 2)) / 10;
const yPos = (event.clientY – (element.offsetTop + element.offsetHeight / 2)) / 10;
// Apply the motion effect to the element
element.style.transform = `translate3d(${xPos}px, ${yPos}px, 0)`;
});