p5.js中的strokeJoin()函数用于设置连接线段的关节样式。这些关节可以斜切,斜切或倒圆,并使用相应的参数MITER,BEVEL和ROUND指定。 MITER是默认关节。
用法:
strokeJoin(join)
参数:该函数接受单个参数联接,该联接存储联接参数常量“ MITER”,“ BEVEL”或“ ROUND”。
以下程序说明了p5.js中的strokeJoin()函数:
示例1:本示例使用strokeJoin()函数来合并笔触。
function setup() { 
      
    // Create Canvas of given size 
    createCanvas(380, 170); 
} 
  
function draw() { 
      
    // Set the background color 
    background(220); 
      
    // Set the stroke weight 
    strokeWeight(12); 
      
    // Set strokeJoin function 
    strokeJoin(ROUND); 
      
    // Function to create line segment 
    line(20, 30, 200, 30); 
    line(200, 30, 200, 100); 
    line(200, 100, 20, 30); 
}输出:

示例2:本示例使用strokeJoin()函数来合并笔触。
function setup() { 
      
    // Create Canvas of given size 
    createCanvas(380, 170); 
} 
  
function draw() { 
      
    // Set the background color 
    background(220); 
      
    // Set the stroke weight 
    strokeWeight(10); 
      
    // Set strokeJoin function 
    strokeJoin(BEVEL); 
      
    // Function to create line segment 
    line(20, 30, 200, 30); 
    line(200, 30, 200, 100); 
    line(200, 100, 20, 100); 
    line(20, 100, 20, 30); 
}输出:

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