Hey elegantseagulls! Thanks for the answer, this pretty much solved it! You're a true hero!
I just wonder I how I could use this along with matchMedia() hence I have to use a different initial state on mobile.
The initial state on mobile would be on 0 on the x-axis and on the y-axis rotation.
I'm pretty sure this code would never work, but for example:
ScrollTrigger.matchMedia({
"(min-width: 1100px)": function() {
ScrollTrigger.create({
trigger: '.container',
scrub: 3,
start: '5% top',
end: '20% top',
onUpdate: (self)=>{
mesh.rotation.y = 2.*3.14 * self.progress -0.22;
mesh.position.x = 15 * self.progress +1;
}
});
},
"(max-width: 600px)": function() {
ScrollTrigger.create({
trigger: '.container',
scrub: 3,
start: '5% top',
end: '20% top',
onUpdate: (self)=>{
mesh.rotation.y = 2.*3.14 * self.progress;
mesh.position.x = 15 * self.progress;
}
});
},
});