xxxxxxxxxx
24
var font;
async function setup() {
createCanvas(200, 200);
font = await loadFont(
'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'
);
background(200);
}
function draw() {
strokeWeight(2);
textSize(50);
const contours = font.textToContours('p5*js', 0, 50, { sampleFactor: 0.5 });
beginShape();
for (const pts of contours) {
beginContour();
for (const pt of pts) {
vertex(pt.x + 20*sin(pt.y*0.01), pt.y + 20*sin(pt.x*0.01));
}
endContour(CLOSE);
}
endShape();
}