// Wait for the DOM to be ready document.addEventListener("DOMContentLoaded", function () { // Select the box element const box = document.getElementById('box'); // Use GSAP to animate the box gsap.to(box, { x: 300, // Destination X position duration: 2, // Animation duration in seconds ease: "power2.inOut", // Easing function (optional) repeat: -1, // Repeat the animation indefinitely yoyo: true // Reverse the animation on each repeat }); });