This tutorial explains how to make an object (such as an image, shape, or text) follow the movement of the mouse, as shown in the example below.
Create a project in WoofJS and add the following code to make an object follow the mouse’s movement on screen.
// Set backdrop colour setBackdropColor("lightblue") // Creat player var player = new Image({ url: "./docs/images/sushi.png", width: 50, height: 40, x: 200 }) forever(() => { // Make player follow mouse on X axis player.x = mouseX // Make player follow mouse on Y axis player.y = mouseY })