Jump to content
Search Community

clipPath property isn't correct when call gsap.to(...).seek(....)

SammyFeng test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

  • Solution

Hi @SammyFeng welcome to the forum!

 

GSAP is really smart and will try to interpret your string and tween the numbers within it, but some times you've to help it a bit. I've find that if I do these kind of tweens all the numbers in the tween should stay consistent between tweens, so in this case I would give all the numbers a % symbol, this way the numbers stay consistent. 

 

Here is a fork of your pen with every number having a %, this seems to work. Hope it helps and happy tweening! 

 

See the Pen NWzLjap?editors=0011 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Just for clarity, when you're animating between two complex string values, GSAP uses the units as defined in the tween (typically a "to()" tween, so the end value). It cannot automatically know everything you intend to do or convert every possible unit inside complex strings. So for example, if you're animating from "inset(0 0 100% 0)" to "inset(0 0 0 0)", notice that there's no unit whatsoever in the final value. That's what it'll use. Basically, it takes the end value and then looks for all the number "slots", then matches those up with the numbers in the starting value's number slots (so the first numbers, the second numbers, the third numbers, etc.) and interpolates accordingly. 

 

So this was expected behavior. And adding the units for consistency is the correct solution from @mvaneijgen ?

  • Thanks 1
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...