Jump to content
Search Community

Conflict between two pin animations

mikhael test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi all 🫡

 

I use two pin animations In the first, the block stands still and the photo is scrolled from bottom to top from the top of the text. in the reviews block, the block also stands still while the animation is running, containers with reviews should move from right to left. Separately, the animations work as they should, but together for some reason an incomprehensible flickering effect occurs. Tell me what could be the problem ?

See the Pen QWPEeRP by mikhail21990 (@mikhail21990) on CodePen

Link to comment
Share on other sites

  • Solution

I didn't have a lot of time to look at this, but it appears to me as though you were creating the ScrollTriggers in the wrong order. You should always create them in the order they appear on the page, -OR- you can set a refreshPriority on them instead so that you can make sure things get refreshed in the proper order. I added a ScrollTrigger.sort() at the end in order to force them to get ordered by their start position: 

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

 

Also, this is not a good idea:

transform: "translateY(100%)"

It's much cleaner, faster, and more efficient to do this: 

yPercent: 100

Does that clear things up? 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, GreenSock said:

I didn't have a lot of time to look at this, but it appears to me as though you were creating the ScrollTriggers in the wrong order. You should always create them in the order they appear on the page, -OR- you can set a refreshPriority on them instead so that you can make sure things get refreshed in the proper order. I added a ScrollTrigger.sort() at the end in order to force them to get ordered by their start position: 

 

 

 

Also, this is not a good idea:

transform: "translateY(100%)"

It's much cleaner, faster, and more efficient to do this: 

yPercent: 100

Does that clear things up? 

Yes, it helped, thank you very much, it turned out to be a simple solution, but can you also find out why this is not a good idea? I really like the library, I would like to understand the intricacies 🙏

Link to comment
Share on other sites

transform is a lot of properties in one, so in your example what happens when you also want to animate scale? or translateX? You would have to merge them all in to one string and animating strings is not always the best idea. GSAP has exposed all the transforms and GSAP also does a lot of optimisations under the hood, so it is best to use the exposed properties for each transforms check the list here https://gsap.com/docs/v3/GSAP/CorePlugins/CSS?_highlight=transform#transforms

 

Hope it helps and happy tweening! 

 

 

  • Like 3
Link to comment
Share on other sites

6 minutes ago, mvaneijgen said:

transform is a lot of properties in one, so in your example what happens when you also want to animate scale? or translateX? You would have to merge them all in to one string and animating strings is not always the best idea. GSAP has exposed all the transforms and GSAP also does a lot of optimisations under the hood, so it is best to use the exposed properties for each transforms check the list here https://gsap.com/docs/v3/GSAP/CorePlugins/CSS?_highlight=transform#transforms

 

Hope it helps and happy tweening! 

 

 

Thank you very much for your work! You are best ! 🌟🌟🌟🌟🌟

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