void setup() { size(400, 400); // Set canvas size } void draw() { background(220); // Set background color // Display the coordinates of the mouse pointer fill(0); // Set fill color to black textSize(30); // Set the text size to 20 (you can adjust this number as needed) text("MouseX: " + mouseX + " | MouseY: " + mouseY, 40, 40); // Display coordinates }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter