Jump to content
Search Community

Animating 3D Button flips it!

JulianBroudy test
Moderator Tag

Recommended Posts

Hello,

 

My button behaves weird after animating it.

For comparison, please interact with the button without touching the code then uncomment one of the options in the JS window and see what happens.

 

In my website it acts even crazier than in the codepen.

Could not upload a gif because it exceeds the upload limit so here is a link for my GDrive: Illustration of Button's behavior.

 

Thank you.

See the Pen mdJzegv by JulianBroudy (@JulianBroudy) on CodePen

Link to comment
Share on other sites

Welcome to the forums, @JulianBroudy

 

It looks to me like the problem has nothing to do with GSAP - it's that you're setting the boundingClientRect constant to aElem.getBoundingClientRect() initially and you're basing all the calculations on that, but then you MOVE the aElem element and you forgot to update its bounding client rect accordingly. So all your calculations are off from that point on. See what I mean? 

 

You could update it in an onUpdate of the animation if you need it constantly updated, or in an onComplete if you just want to delay it until then. It's up to you. 

 

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

 

Does that help?  

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