To make the text follow the mouse, we need to glean the coordinates of the cursor at the moment it enters the shapes and each moment while it’s moving around over the shape. You may notice that there’s a variable
e that gets passed to the anonymous function inside the mouseover event. Every event has a variable like this that contains information about the event, like where the mouse is on the screen when it’s fired and what object the user interacted with to trigger the event. We don’t actually use
e in the previous example, but I always include it out of habit since it’s so useful.