justcasper Posted January 22, 2021 Share Posted January 22, 2021 Hi, i try to trigger a drag from another function. when i use TweenLite.to(".nav-main", 0.3, {x:-2000}); it doesn't trigger my onDrag. Is there another way to simulate the drag?https://jsfiddle.net/o9yt0bv1/2/ Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 22, 2021 Share Posted January 22, 2021 Hey justcasper. First off, we highly recommend using the GSAP 3 syntax. Not doing so is one of the most common GSAP mistakes. As for your question, Draggable has an .update() function that does just that: https://jsfiddle.net/xs3rpco2/ Link to comment Share on other sites More sharing options...
justcasper Posted January 22, 2021 Author Share Posted January 22, 2021 Hi, thanks for your reply. So i have to avoid "TweenLite..." ? Thanks for the advice. Your changed code still does not call the onDrag otherwise the "salmon" text would stick to the right. Link to comment Share on other sites More sharing options...
Solution ZachSaucier Posted January 22, 2021 Solution Share Posted January 22, 2021 47 minutes ago, justcasper said: i have to avoid "TweenLite..." ? We recommend doing so. Why would you want to keep it? The new syntax is better There are other updates as well that you can read about in the linked articles. 47 minutes ago, justcasper said: Your changed code still does not call the onDrag otherwise the "salmon" text would stick to the right. If you want the onDrag function to be called as well you should call it separately: https://jsfiddle.net/mt6eukdz/ 1 Link to comment Share on other sites More sharing options...
justcasper Posted January 24, 2021 Author Share Posted January 24, 2021 Thank you! Is there a way to make it slower? Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 25, 2021 Share Posted January 25, 2021 19 hours ago, justcasper said: Is there a way to make it slower? Make what slower? The animation? Your duration and easing are the main controls over that. 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