I’ve been trying to create a sketch that moves a shape towards the mouse and then returns to a given starting point. This sketch does what I want with one shape but I want to have multiple shapes beginning from different starting points on the canvas.
I created a new sketch where I put the code into a function called “arrow”, hoping to call it multiple times, creating other shapes with different starting points, all moving towards the mouse.
As you can see from the links, in the second sketch the shapes no longer move towards the mouse.
I was wondering why this is? The values used are the same, perhaps it has something to do with where the mouse position is referred to in the order of execution?
Any light you could shed on this would be really helpful.