xxxxxxxxxx
41
function setup() {
createCanvas(600, 600);
}
var x = [];
var y = [];
var twoDlist = [];
var points = [];
class Point {
constructor(mousex, mousey) {
this.x = mousex;
this.y = mousey;
}
}
function draw() {
background(0,50);
strokeWeight(5);
noFill();
stroke(255);
beginShape();
for (var k = 0; k < points.length; k++) {
var rand = random(5)
curveVertex(points[k].x + random(70/(k+1)), points[k].y+rand);
}
endShape();
}
function mouseMoved() {
if (points.length > 100) {
points.shift();
} else {
points.push(new Point(mouseX, mouseY));
}
}