xxxxxxxxxx
18
function setup() {
createCanvas(windowWidth, windowHeight);
// Set the text size for better visibility
textSize(18);
}
function draw() {
// Clear the canvas and set the background color
background(220);
// Get the mouse x and y position
let mouseXPosition = mouseX;
let mouseYPosition = mouseY;
// Display the mouse positions
text("X: " + mouseXPosition + ", Y: " + mouseYPosition, 10, 30);
}