Kevin Powell - CommunityKP-C
Kevin Powell - Community13mo ago
25 replies
Nick

Animating clip path with gsap?

Anyone know why animating this clip-path isn't working? It's just jumping from the initial to end state, and I'm not sure why :/

https://codepen.io/nwoodward/pen/bNbWJKK?editors=1010

<svg width="0" height="0">
  <clipPath id="svgClip" clipPathUnits="objectBoundingBox">
    <path d="M0 0 H100 A0 0 0 0 1 100 100 H0 A0 0 0 0 1 0 0 Z"></path>
  </clipPath>
</svg>

gsap.to(".hero", {
  clipPath: `path("M20 10 H80 A20 20 0 0 1 80 90 H20 A20 20 0 0 1 20 10 Z")`,
  ease: "none",
  scrollTrigger: {
    trigger: ".hero",
    start: "1px top",
    end: "bottom top",
    pin: true,
    markers: true,
    toggleActions: "play reverse play reverse",
  },
});
Was this page helpful?