Processing.js

ContinuousLines

Click and drag the mouse to draw a line.

Original Processing.org Example: ContinuousLines

// All Examples Written by Casey Reas and Ben Fry
// unless otherwise stated.
void setup() {
  size(200, 200);
  background(102);
}

void draw() {
  stroke(255);
  if(mousePressed) {
    line(mouseX, mouseY, pmouseX, pmouseY);
  }
}