Example 0 3
[Examples 0] 0 1 2 3 4 5 6 7 8 9
// line between two points // one fixed, one draggable int x1 = 120; int y1 = 80; int x2 = 240; int y2 = 160; void setup() { size(360, 240); smooth(); stroke(0); } //setup void draw() { background(207); strokeWeight(3); line(x1, y1, x2, y2); strokeWeight(1); fill(255, 255, 0); ellipse(x1, y1, 5, 5); fill(255, 0, 0); ellipse(x2, y2, 5, 5); } //draw void mouseDragged() { x1 = mouseX; y1 = mouseY; } //mouseDraggedDrag one end of line.