I finally reached my goal! 2 days of work )) 2 of your tips )) And I did it.
Your option with onToggle works, but when you scroll quickly it breaks. or if you scroll not all the way back and back.
At first I had the idea to add and remove classes like
gsap.to("body", {className:"+=yellow-bg black-text"})
Eventually after looking through the documentation, I realized that I could use onEnter: () => and onLeaveBack: () => for each section just by substituting reverse values respectively. And it worked just the way I wanted it to! Fast and accurate))
Here is my updated pin:
https://codepen.io/Lkey/pen/NWvPyrQ
Now I don't know how I can change those color and background-color values via CSS,
because they are written inside the element. I saw there is a CSSPlugin...Can it help me do a hover for values for example? Or should I just animate them with gsap?
Nevertheless, thank you so much for the trouble )