We create to variables called mouseX and mouseY. Then we subtitute the variables in the code where are the position x and y. And we do this in everithing and that it.
See the Pen https:// by Alfonso (@sito12) on CodePen.