xxxxxxxxxx
19
function setup() {
createCanvas(400, 400, WEBGL);
const pts = []
for (let i = 0; i < 50; i++) {
pts.push(createVector(random(width), random(height)))
}
const snake = buildGeometry(() => {
noFill()
beginShape()
for (const [i, { x, y }] of pts.entries()) {
vertexProperty('length', i/(pts.length-1))
splineVertex(x, y)
}
endShape()
})
}