// Variables that store the last mouse pressed position. int lastX; int lastY; void setup() { size(500, 300); } void draw() { /* must exist */ } // Draw a line from the last mouse position // to the current position. void mousePressed() { line(lastX, lastY, mouseX, mouseY); lastX = mouseX; lastY = mouseY; }