Drymy Posted October 3, 2021 Share Posted October 3, 2021 Hello! I'm trying to use convertCoordinates from the MotionPathPlugin but sadly i can't manage to make it work despite my tries. I cannot make a CodePen but i made a CodeSandbox rather here : https://codesandbox.io/s/solitary-morning-0v5l8?file=/src/App.js The goal was to move the green bloc to the blue bloc by giving it its coordinates. If i input a manual value on x such as 300 then the green bloc moves but using convertCoordinates never works whatever i try. My best guess was a weird interaction with useRef or useEffect since i can't use variables like in the documentation, but i don't know how to solve it.. Any ideas please? Thank you! Link to comment Share on other sites More sharing options...
Solution OSUblake Posted October 3, 2021 Solution Share Posted October 3, 2021 Hi Drymy! In the docs is says not to use a string selector, so you should use a ref instead e.g. let p = MotionPathPlugin.convertCoordinates(blueBloc.current, greenBloc.current, { x: 0, y: 0 }); Link to comment Share on other sites More sharing options...
Drymy Posted October 3, 2021 Author Share Posted October 3, 2021 OH my god i'm so stupid, sorry about that and thank you so much, it works perfectly!! 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