p5.js中的bezierDetail()函数用于设置Beziers显示的分辨率。为了使用它,我们必须使用WEBGL render参数。
用法:
bezierDetail( detail )
参数:该函数接受单个参数详细信息,该详细信息存储曲线的分辨率。
以下程序说明了p5.js中的bezierDetail()函数:
示例1:本示例使用bezierDetail()函数设置Beziers显示的分辨率。
function setup() { 
  
    // Create canvas size 
    createCanvas(450, 310, WEBGL); 
      
    // bezierDetail() function 
    bezierDetail(6); 
} 
  
function draw() { 
  
    // Set the background color 
    background(220); 
    noFill(); 
      
    // Bezier function with 8 parameters  
    // except z-coordinate 
    bezier(85, 20, 10, 10, 160, 90, 50, 80); 
}输出:

示例2:本示例使用bezierDetail()函数设置Beziers显示的分辨率。
function setup() { 
      
    // Create canvas of given size 
    createCanvas(350, 350, WEBGL); 
      
    // Use bezierDetail function 
    bezierDetail(4); 
} 
  
function draw() { 
      
    // Set background color 
    background(0, 0, 0); 
      
    noFill(); 
      
    // Set stroke color 
    stroke(255); 
      
    // Draw bezier curve 
    bezier(150, 50, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0); 
}输出:

参考: https://p5js.org/reference/#/p5/bezierDetail
相关用法
- PHP cos( )用法及代码示例
 - d3.js d3.hsl()用法及代码示例
 - p5.js sin()用法及代码示例
 - p5.js tan()用法及代码示例
 - p5.js log()用法及代码示例
 - PHP key()用法及代码示例
 - d3.js d3.min()用法及代码示例
 - p5.js cos()用法及代码示例
 - PHP pos()用法及代码示例
 - PHP each()用法及代码示例
 - PHP each()用法及代码示例
 - p5.js second()用法及代码示例
 
注:本文由纯净天空筛选整理自sarthak_ishu11大神的英文原创作品 p5.js | bezierDetail() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
