Jump to content
Search Community

Converting gsap2->3

NickNo test
Moderator Tag

Recommended Posts

Hi, I'm having a little trouble converting an old codepen over to gsap3 ... I thought I had it covered - but the transition has messed up - I have lost the skew and the back animation isn't right .... any suggestions?

 

GSAP3 version

See the Pen jOVoqKy by nickjacobsnz (@nickjacobsnz) on CodePen

 

GSAP2 version

 

 

 

 

See the Pen zYZXMJm by nickjacobsnz (@nickjacobsnz) on CodePen

Link to comment
Share on other sites

There is no "className" plugin baked into GSAP 3. We removed that for several reasons: 

  1. It's almost always better to directly animate individual properties. It's MUCH faster (performance). Animating to/from a class requires literally comparing every...single...CSS property and isolating the ones that are different. 
  2. We wanted to streamline things in GSAP 3 and shave off file size. 

For your demo, you can just animate the clipPath property since that's the only thing those className tweens were doing: 

See the Pen oNZOJaY?editors=0010 by GreenSock (@GreenSock) on CodePen

 

I personally would structure things a bit differently so that it's all dynamic. That means if the user clicks multiple times quickly, it still works smoothly: 

See the Pen yLMrGQr?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 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...