Jump to content
Search Community

GSAP FLIP using Scrolltrigger not working properly while Scrubbing back to TOP

Qamar Aziz
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Posted

Hi Awesome, GSAP community!

 

I'm trying to achieve scrubbing using GSAP Flip animation.
I'm facing an issue while scrubbing back to the top.

 

Any idea why it's happening? Here is the codepen URL: 

 

When the end of the element crosses the center of the screen, while scrubbing back GSAP FLIP doesn't work properly, am I doing something wrong?

See the Pen XWGozxM by azizqamar7 (@azizqamar7) on CodePen.

  • Solution
Posted

Hi @Qamar Aziz and welcome to the GSAP Forums!

 

This mostly has to do with the absolute config which is not really needed in this case and the fact that Flip does a lot of cleanup when the animation is completed in order to respect the way the DOM is layed out at the beginning of the animation.

 

This seems to work the way you expect:

See the Pen PoLXRmy by GreenSock (@GreenSock) on CodePen.

 

Hopefully this helps.

Happy Tweening!

Posted

Thank You so much @Rodrigo

The switch of both images is very smooth now. How does'autoAlpha' help make it visible or hidden? I thought it was only used for opacity switch.

Posted

Hi,

 

The autoAlpha option is a combination of opacity and visibility, so when you tween/set the autoAlpha value to 0 what GSAP does is animate the opacity to 0 and when the tween is completed it sets the visibility to hidden. If you have an element with opacity: 0 and visibility: hidden and you tween autoAlpha to 1, GSAP starts by setting the visibility property to visible and then animates the opacity to 1 (or any other value different than zero that you passed in the config object.

 

Hopefully this clear things up.

Happy Tweening!

  • Like 1
Posted

Got it. Can we set autoAlpha between 0 and 1 (Like 0.2)?

And what happens to visibility if we set any value between 0 and 1?

Posted
5 hours ago, Qamar Aziz said:

Got it. Can we set autoAlpha between 0 and 1 (Like 0.2)?

And what happens to visibility if we set any value between 0 and 1?

Think of autoAlpha like simply "opacity" that will automatically set visibility: hidden if/when it hits exactly 0. So yes, you can set autoAlpha to any value between 0 and 1, inclusively. If it's non-zero, visibility will be inherit. 

  • Like 1
Posted

Now I get it. Thank you for making this clear. 

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