import anime from "animejs/lib/anime.es.js";

export default function initLogos() {
   const lists = document.querySelectorAll(".logos__track");

   lists.forEach((track) => {
      const items = track.querySelectorAll(".logos__item");
      const length = items.length;

      const width = track.scrollWidth / 2;

      const animation = anime({
         targets: track,
         translateX: [0, -width],
         duration: 5000 * length,
         easing: "linear",
         loop: true,
      });

      track.addEventListener("mouseenter", () => animation.pause());
      track.addEventListener("mouseleave", () => animation.play());
   });
}
