xxxxxxxxxx
35
let facemesh;
function preload() {
facemesh = loadJSON("facemesh.json");
}
function setup() {
createCanvas(400, 400);
background(220);
const vertices = [];
const vertexCount = 3;
const len = Object.keys(facemesh).length;
for (let i = 0; i < len; i++) {
vertices[i] = [];
for (let j = 0; j < vertexCount; j++) {
vertices[i][j] = facemesh[j + i * vertexCount];
}
}
stroke(0);
beginShape();
for (let k = 0; k < 90; k++) {
for (let l = 0; l < vertexCount; l++) {
let x = vertices[k][l][0];
let y = vertices[k][l][1];
vertex(x, y);
endShape(CLOSE);
}
}
}
function draw() {}