daniel.mt Posted February 24, 2023 Share Posted February 24, 2023 Hey there. There is one question that is bothering me and avoided it for quite some time. In scrolltrigger you have the directional property. If it's true you get to the last intended snap on a small scroll. If it's false you get it to the closest value so that is I suppose around the distance from a to b splitted by half . But with directional false can you change how close that value is ? Right now it's working this way: Values: [0, 0.5, 1] 0 -> 0.5 it will snap at 0.25 this means 50% of 0.5 . But can we snap to 0.5 when it gets to the 0.1 value that means 20% ? 0.5 -> 1 it will snap to 1 at 0.75 . Can this be change to 0.6 to snap to 0.75? this means 20% ? See the Pen ZEMpYKR by danielmtd (@danielmtd) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted February 24, 2023 Share Posted February 24, 2023 So you basically want directional snap...but only if it's beyond a certain distance? You can definitely run your own custom logic by using a function-based value on your snapTo, sure. If you need help crafting the logic in that function to deliver the results you want (assuming nobody else does it for you here), feel free to reach out to us for paid consulting services. We're happy to answer GSAP-specific questions here in the free forums but when you get into crafting custom logic, that's a bit beyond the scope of help we provide in the forums. We'd be glad to help, though. Link to comment Share on other sites More sharing options...
GreenSock Posted February 24, 2023 Share Posted February 24, 2023 By the way, thanks for providing such an excellent minimal demo! 💚 I wish everyone was that thoughtful. 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