let newFont;
function
preload() {
newFont = loadFont(
"fonts/Montserrat.otf"
);
}
function
setup() {
createCanvas(500, 200, WEBGL);
textFont(newFont, 14);
}
function
draw() {
background(
"green"
);
fill(
"black"
);
text(
"The curve below is made using curveVertex() function in WebGL"
, -245, -75);
let p1 = { x: -200, y: 175, z: 0 };
let p2 = { x: -200, y: 25, z: 0 };
let p3 = { x: 150, y: 25, z: 0 };
let p4 = { x: 275, y: 175, z: 0 };
noFill();
beginShape();
curveVertex(p1.x, p1.y, p1.z);
curveVertex(p2.x, p2.y, p2.z);
curveVertex(p3.x, p3.y, p3.z);
curveVertex(p4.x, p4.y, p4.z);
endShape();
}