Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Can't make convertCoordinates() work on React

Go to solution Solved by OSUblake,

Recommended Posts


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 :



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

  • Solution

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.