AlesS Posted April 26, 2022 Share Posted April 26, 2022 Hello, at first I am sorry to use the forum as non skilled. And now to my scenario. I just don't know where should I start. I have my header and first section on the website. In this section, I want to have: Heading Button Button Image These should be visible when user open the website. When user start scrolling, then I want to change the content slowly (not parallax but some kind of blending) to the: Heading 2 Button Image After that, I would like to scroll normally to the other sections on the page. I want to do it slowly for image and faster for Heading and buttons. As I read some documentation, I already know I should use ScrollTrigger somehow and propably a pinning. I am completely new and my english is not so good. Can anyone help me plese? Thank you very much! See the Pen rNpEPZj by alkokod (@alkokod) on CodePen Link to comment Share on other sites More sharing options...
OSUblake Posted April 26, 2022 Share Posted April 26, 2022 Welcome to the forums @AlesS I would recommend starting out by solving the animation first. Once your animation like you want, then all you have to do is hook it up to a ScrollTrigger and you should be good to go. I'm assuming you're trying to do a crossfade, so you'll probably need to absolute position the second section over the first section. Then use a Timeline and the position parameter to do your fading. If you get stuck along the way, just a post a demo of your work and we nudge in the right direction. 4 Link to comment Share on other sites More sharing options...
AlesS Posted April 26, 2022 Author Share Posted April 26, 2022 Hello @OSUblake. I have figured out the crossfade (propably). I have edited the Codepen. I am not sure if my hack with z-index is needed, but I added it because the absolute section was flashing over the first one. Did I do that right? What should I do next? Hook the Scrolltrigger to it, can you point me little bit please? I really appreciate your help. Link to comment Share on other sites More sharing options...
OSUblake Posted April 27, 2022 Share Posted April 27, 2022 Instead of messing with the z-index, you can animate autoAlpha instead of opacity. It's just like opacity except that when it is at 0, it will set the visibility to hidden. That means you click your first panel while the second panel is hidden. So now you just need to hook it up to ScrollTrigger. I added some empty .set() tweens in there just to add a little gap in between each section's animation. See the Pen BaJXBrb by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted April 27, 2022 Share Posted April 27, 2022 And if you don't want the flash of green in-between you just have to flip around the position parameter from ">" to "<" than the second tween will start at the same time as the previous tween! See the Pen zYpgGZB?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen 4 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now