I successfully implemented this animation using GSAP and you can view the Codepen for reference:
https://codepen.io/whitelionx/full/vYGQqBZ
const svgs = document.querySelectorAll("svg");
svgs.forEach((svg) => {
const tl = gsap
.timeline({
defaults: { ease: "power1.in" },
paused: true
})
.to(svg.children[0], { drawSVG: "50% 50%" })
.from(svg.children[1], { drawSVG: "0% 0%" }, 0);
svg.addEventListener("mouseenter", () => tl.play());
svg.addEventListener("mouseleave", () => tl.reverse());
});
However, I am now looking to achieve the same effect using only CSS. To demonstrate this, I have created a code sandbox:
https://codesandbox.io/s/xenodochial-benz-17lss?file=/src/styles.css