I am new to GSAP.
This pen works well. But I want to do a simple change in the .to part - I want the image to move downwards and fade off when the user scroll past. That is, currently, the code is
gsap.timeline().from(".left-div img", {
y: 200,
scrollTrigger: {
trigger: ".left-div img",
start: "-800px",
end: "-400px",
scrub: true
}
}).to(".left-div img", {
opacity: 0,
x:100,
scrollTrigger: {
trigger: ".left-div img",
start: "-200px",
end: "-150px",
scrub: true
}
})
Please note the 11th line - x: 100. I want it to be y: 100 instead. Only the 11th line changes.
gsap.timeline().from(".left-div img", {
y: 200,
scrollTrigger: {
trigger: ".left-div img",
start: "-800px",
end: "-400px",
scrub: true
}
}).to(".left-div img", {
opacity: 0,
x:100,
scrollTrigger: {
trigger: ".left-div img",
start: "-200px",
end: "-150px",
scrub: true
}
})
When I do so, it shows unexpected result - the image jumps down. That's the problem.
Could someone help me out?
Please correct me if this isn't the real way to accomplish this.