Outdoor Travel & Adventure Pins

  • Sale
  • Regular price $3.00
Shipping calculated at checkout.



/** * Function to move the background of a website like reptile scales. * * @param {string} elementId - The ID of the element to apply the background movement. * @param {number} speed - The speed of the background movement. * @param {number} scale - The scale of the background movement. */ function moveBackgroundLikeReptileScales(elementId, speed, scale) { const element = document.getElementById(elementId); // Check if the element exists if (!element) { console.error(`Element with ID "${elementId}" not found.`); return; } // Set the initial background position let position = 0; // Function to move the background function moveBackground() { // Calculate the new background position position += speed; // Apply the background position element.style.backgroundPosition = `${position}px ${position}px`; // Apply the background scale element.style.transform = `scale(${scale})`; // Request the next animation frame requestAnimationFrame(moveBackground); } // Start the background movement moveBackground(); } // Usage Example // Move the background of the element with ID "background" like reptile scales moveBackgroundLikeReptileScales("background", 2, 1.2);