bs.choi Posted January 22, 2022 Share Posted January 22, 2022 Hi. I made a follow cursor using gsap's quickSetter and ticker. Originally there was no problem, but a bug occurred while refactoring. I really don't know why. new ver https://jsfiddle.net/kebqswL4/6/ previous ver https://jsfiddle.net/kebqswL4/7/ The reason I did the refactoring was because I wanted to handle similar calculations in one function. Please help me... Link to comment Share on other sites More sharing options...
GreenSock Posted January 22, 2022 Share Posted January 22, 2022 We really try to keep these forums focused on GSAP-specific questions (not general logic ones), but I assume this is what you wanted: https://jsfiddle.net/cxLesp36/ Your code was assuming that this was actually changing the pos.y/pos.x: const posSet = (p, m, d) => p += (m - p) * d; But it wasn't - that is merely changing the LOCAL VARIABLE named "p". You also had typos where you used "y" instead of "x": // bad const xSetFollowPos = posSet(posF.y, mouse.y, dtF); // good const xSetFollowPos = posSet(posF.x, mouse.x, dtF); Good luck! 1 Link to comment Share on other sites More sharing options...
bs.choi Posted January 23, 2022 Author Share Posted January 23, 2022 @그린삭스 that's right!! this is it! thanks for your help 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