Hello everyone ?
I am quiet new to greensock. Currently I am using ScrollTrigger and the MotionPathPlugin.
Here is what I have: https://kwizda.gugler.at/
the tractor is moving on the path perfectly, but as you may see the path isn't moving in the free space given instead its overlapping with the content. On my screen it works perfectly fine, but by changing to another screen it's wrong.
Do you have any idea how I could change the path related to the content?
Here is my code:
gsap.registerPlugin(MotionPathPlugin, ScrollTrigger);
gsap.set("#motionSVG", { scale: 0.8, autoAlpha: 1 });
gsap.set("#tractor", {transformOrigin: "50% 50%"});
gsap.to("#motionSVG", {
scrollTrigger: {
trigger: "#motionPath",
start: "top 35%",
end: "bottom 35%",
scrub: 1,
onUpdate: self => {
gsap.to("#tractor", { rotation: () => self.direction === 1 ? 0 : -180, overwrite: 'auto', duration: 0.1,});
}
},
duration: 10,
ease: "none",
immediateRender: true,
motionPath: {
path: "#motionPath",
align: "#motionPath",
alignOrigin: [0.5, 0.5],
autoRotate: 90,
}
});