Hey,
Im quite new to GSAP. Im using Next.js (13) + Tailwind + GSAP. Trying to create a simple scrollTrigger animation. Sorry that I don't have an example. Currently not sure how to make this presentable within next.js.
I have an image sprite where I want to adjust the background x position to slide through basically and it should look like an animation.
gsap.to(ref, {
backgroundPositionX: (-offset_value * frame_count * 2) + "px",
ease: "steps(" + frame_count + ")", // use a stepped ease for
scrollTrigger: {
trigger: ".scene",
start: "top top",
end: "200",
pin: true,
scrub: true,
markers: true
}
});
When Im scrolling to the start position of scrollTrigger the background image is jumping down by the px value I added to "end". In the css gsap is adding some transition to by this value. If I remove this value the background is at the correct position, but I guess there is some reason for that.
I hope someone can help me and this is understandable
CSS:
.viewer {
min-height: 1000px;
width: 100vw;
background-image: url(background.png);
background-repeat: no-repeat;
background-position-x: 0;
background-position-y: 0;
}
Greetings,
Daniel