Jump to content
Search Community

Clip-path not animated smoothly

AlexanderGS test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

  • Solution

Hi there!

 

Just some numbers that GSAP is struggling to tween between.

If you make them all percentages it works fine. It's hard for GSAP to animate between 0 and 100% as they're different units.

 

timeline.fromTo(
  ".home__text span",
  {
    y: 30,
    clipPath: "polygon(100% 100%, 0% 100%, 0% 100%, 100% 100%)"
  },
  {
    y: 0,
    clipPath: "polygon(100% 100%, 0% 100%, 0% 0%, 100% 0%)",
    duration: 0.8,
    stagger: 0.2,
  }
);

 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

@hinderwhack yeah, that's because it's just animating a complex string which involves isolating the numbers in each string (the beginning and ending one), and then interpolating those. So the first number in the starting string gets matched with the first number in the ending string, and so on. Otherwise, it would take a LOT more custom code to try to parse and convert every possible unit at every position, thus the GSAP core would grow. Everyone would pay the kb price for a feature that almost nobody would use. In the vast majority of cases, it's quite simple to just format the start/end strings properly to get the result you want (match units). 👍

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...