xxxxxxxxxx
33
var points = [];
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
noFill();
beginShape();
for( let i = 0; i < points.length; i++){
vertex(points[i].x, points[i].y);
}
endShape();
}
function mouseClicked()
{
points.push({
x: mouseX,
y: mouseY
})
console.log(points);
}
function keyPressed()
{
if( key == " "){
points = [];
}
}