plastois Posted December 16, 2020 Share Posted December 16, 2020 Hello! I searched docs and forums but i can't find answer for my problem. I have ScrollTrigger animation, where xPercent is a variable. I want change it on refresh, like this: gsap.to(".class", { scrollTrigger: { trigger: parent_trigger, pin: true, start: "top top", markers: true, scrub: 1, invalidateOnRefresh: true, snap: { snapTo: 1 / 200, duration: {min: 0.2, max: 0.3}, delay: 0 }, onRefresh: () => { let scroll_width = 100 - ($(window).width()*100 / width); xPercent: -scroll_width }, }, xPercent: -scroll_width, ease: "none", }); Is there any way to archive my goal? Link to comment Share on other sites More sharing options...
Solution ZachSaucier Posted December 16, 2020 Solution Share Posted December 16, 2020 Hey plastois. You just need to make sure xPercent has a functional value: xPercent: () => -scroll_width 2 1 Link to comment Share on other sites More sharing options...
plastois Posted December 16, 2020 Author Share Posted December 16, 2020 Thanks! I totally forgot about functional values! I also put all calculations inside xPercent function instead of onRefresh, it works better 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now