Hi @Cassie,
Thanks again for previously for your help - I've hit another problem!
For some reason my elements are 'skating' from right to left, not during the scroll.
For example - Similar to my codepen above, where the divs are changing colours, I am having an image start at -30% then as they enter the viewport, I want them to move to 0%, What I have so far works BUT I am getting a skating effect so they just seem to slide from their starting position to end position. Hope this makes sense?
const sections = gsap.utils.toArray(".meet-the-team div.member");
let maxWidth = 0;
sections.forEach((section) => {
maxWidth += section.offsetWidth;
});
/**
* Horizontal Scroll for Team Members
*/
let memberAnimation = gsap.to(sections, {
scrollTrigger: {
trigger: ".meet-the-team",
start: 'top top',
end: () => `+=${maxWidth - window.innerWidth }`,
scrub: 1,
},
x: () => `-${maxWidth - window.innerWidth}`,
ease: "none",
});
/**
* only animate when the img comes into viewport
*/
gsap.utils.toArray( 'img.member' ).forEach(el => {
gsap.to( el, {
scrollTrigger: {
trigger: el,
containerAnimation: memberAnimation,
start: 'left 85%',
end: 'center 20%',
scrub: true,
},
x: "-30%",
ease: "none",
});
});