point()函数是p5.js中的内置函数,用于在给定坐标位置绘制点。
用法:
point( x, y, [z])
参数:该函数接受以下三个参数
- x:用于设置点的x坐标。
 - y:用于设置点的y坐标。
 - z:它用于在WebGL模式下设置z坐标。
 
示例1:
function setup() { 
  
    // Create Canvas of given size  
    createCanvas(400, 300); 
  
} 
  
function draw() { 
  
    // Use point() function to draw point 
    point(50, 50); 
    point(150, 50); 
    point(50, 150); 
    point(150, 150); 
  
    // Use strokeWeight() function to set 
    // the weight of point 
    strokeWeight(10); 
}输出:

示例2:
function setup() {  
      
    // Create Canvas of given size  
    createCanvas(400, 300);  
}  
  
function draw() {  
      
    // Set the background color 
    background('green'); 
      
    // Set the stroke weight 
    strokeWeight(10); 
  
    // Set stroke color 
    stroke('white'); 
  
    // Draw point 
    point(50, 50); 
    
    point(50, 250); 
    
    point(350, 50); 
    
    point(350, 250); 
    
    point(200, 150); 
    
} 输出:

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