xxxxxxxxxx
var points;
function setup() {
createCanvas(400, 400);
points = [];
}
function draw() {
background(220);
noFill();
strokeWeight(3);
strokeJoin(ROUND);
beginShape();
for (var i = 0; i < points.length; i++) {
vertex(points[i].x, points[i].y);
points[i].y += 3.0; // conveyor belt!
}
endShape();
}
function mouseDragged() {
var aNewPoint = createVector(mouseX, mouseY);
points.push(aNewPoint);
}
function mousePressed() {
var aNewPoint = createVector(mouseX, mouseY);
points.push(aNewPoint);
}