buster808 Posted May 2, 2021 Share Posted May 2, 2021 Hi, how can i change start and end values when scrolling upwards with scroll trigger. I tried using onUpdate but no joy. Thanks Link to comment Share on other sites More sharing options...
GreenSock Posted May 2, 2021 Share Posted May 2, 2021 Change the start and end values of what exactly? Can you please be a bit more specific? Better yet, a minimal demo would go a LONG way toward getting you a relevant answer We'd love to help - I'm just not sure what you're asking. Link to comment Share on other sites More sharing options...
buster808 Posted May 2, 2021 Author Share Posted May 2, 2021 Hi, its for scrolltrigger - change start and end when scrubbing upwards. As my hero goes off screen when scrubbing upwards. Ill do a pen if this doesnt help gsap.timeline({ scrollTrigger:{ ease: "none", trigger: "#demo", start: "top +35%", end: "bottom +60%", scrub: 0.4, Thanks Link to comment Share on other sites More sharing options...
Rodrigo Posted May 2, 2021 Share Posted May 2, 2021 Hi, You mean a different start and end points depending on the scroll direction? If that's what you're looking for, I don't know if that's possible with the current API. It seems that the config() method is intended for other purposes, as start and end values are read only. The only thing I can think of is to re-create the ScrollTrigger instance with the new values using the onLeave and onLeaveBack callbacks. Perhaps @GreenSock or @OSUblake could shed some light on that subject. Happy Tweening!!! 1 Link to comment Share on other sites More sharing options...
buster808 Posted May 2, 2021 Author Share Posted May 2, 2021 Yes thats right Rodrigo Ill try your method thanks. I see this on direction ScrollTrigger.create({ trigger: ".trigger", start: "top center", end: "+=500", onUpdate: self => console.log("direction:", self.direction) }); Reflects the moment-by-moment direction of scrolling where 1 is forward and -1 is backward. Just dont know how to code the onUpdate. My javascript is basic. Link to comment Share on other sites More sharing options...
GreenSock Posted May 3, 2021 Share Posted May 3, 2021 I'm still pretty lost, sorry. Why would you want to change the start/end values? I'm relatively confident that you probably don't actually want to do that and once you explain a bit more about the "why" behind your request, we may be able to offer a much simpler solution. Changing the start/end based on direction sounds like something that'd create some major logic issues, but perhaps I'm misunderstanding. 17 hours ago, buster808 said: As my hero goes off screen when scrubbing upwards A minimal demo is worth 10,000 words Technically you could create two different ScrollTriggers, and just use onEnter/onLeave callbacks on one, and then onEnterBack/onLeaveBack on the other because those are direction-specific. But again, I have a strong suspicion there's a cleaner solution that'll become apparent once you describe the "why" behind your request and provide that minimal demo. 👍 2 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