The bezierDetail() function in p5.js is used to set the resolution at which Beziers display. In order to use it we must use WEBGL render parameter.
Syntax:
bezierDetail( detail )
Parameters: The function accepts single parameter detail which stores the resolution of the curves.
Below programs illustrate the bezierDetail() function in p5.js:
Example 1: This example uses bezierDetail() function to set resolution at which Beziers display.
function setup() {
createCanvas(450, 310, WEBGL);
bezierDetail(6);
}
function draw() {
background(220);
noFill();
bezier(85, 20, 10, 10, 160, 90, 50, 80);
}
|
Output:

Example 2: This example uses bezierDetail() function to set resolution at which Beziers display.
function setup() {
createCanvas(350, 350, WEBGL);
bezierDetail(4);
}
function draw() {
background(0, 0, 0);
noFill();
stroke(255);
bezier(150, 50, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0);
}
|
Output:

Reference: https://p5js.org/reference/#/p5/bezierDetail