Jump to content
Search Community

Translated element as scroll trigger trigger element

someguy test
Moderator Tag

Recommended Posts

Hello,

I am trying to use an element as a scroll trigger which itself (or its parent) is animated/translated.

Basically the .content should scroll over the .header and inside content there are scrollTriggers which animate the content (h1, p).


Problem is because .content is translated by the timeline and first scrollTrigger, its start and end positions stay in the original location (before the transformation is applied) which is never reachable and wrong, it should also consider the y-translation.

How can I get this to work? Ive tried calling ScrollTrigger.update in the onUpdate of the translate tween but its causing to much lag/stuttering.

 

 


 

See the Pen KKYEvRo by TheM (@TheM) on CodePen

Link to comment
Share on other sites

Thanks for your reply.
I have tried it but it only seems to work because if you look closely the start positions are not exactly where theyre supposed to.
I also have the problem that I have multiple of these sections and do not know what content is inside .content

 

 

I have updated the demo here incorporating your soltion.
It has 2 functions v1 and v2 where the difference is that v1 crates children with parents one by one while v2  first  creates all children and then all parents.

 

See the Pen ZEZPXxE by TheM (@TheM) on CodePen

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