Name |
beginContour()开始负形状 |
Examples |
size(100, 100); translate(50, 50); stroke(255, 0, 0); beginShape(); // Exterior part of shape, clockwise winding vertex(-40, -40); vertex(40, -40); vertex(40, 40); vertex(-40, 40); // Interior part of shape, counter-clockwise winding beginContour(); vertex(-20, -20); vertex(-20, 20); vertex(20, 20); vertex(20, -20); endContour(); endShape(CLOSE); |
Description |
Use the beginContour() and endContour() function to create negative shapes within shapes such as the center of the letter ‘O’. beginContour() begins recording vertices for the shape and endContour() stops recording. The vertices that define a negative shape must “wind” in the opposite direction from the exterior shape. First draw vertices for the exterior shape in clockwise order, then for internal shapes, draw vertices counterclockwise. These functions can only be used within a beginShape()/endShape() pair and transformations such as translate(), rotate(), and scale() do not work within a beginContour()/endContour() pair. It is also not possible to use other shapes, such as ellipse()or rect() within. 使用 beginContour () 和 endContour () 函数在形状 (如字母 “o” 的中心) 内创建负形状。beginContour () 开始记录形状的顶点, endContour () 停止录制。定义负形状的顶点必须与外部形状相反的方向 “风“。首先以顺时针顺序绘制外部形状的顶点, 然后对内部形状进行逆时针绘制顶点。
这些函数只能在 beginShape ()/endShape () 对中使用, 而转换 (如平移 ()、旋转 () 和缩放 () 在 beginContour ()/endContour () 对中不起作用。也不可能使用其他形状, 如椭圆 () 或矩形 ()。 |
Syntax |
beginContour() |
Returns |
void |
- 本文固定链接: http://iprocessing.cn/2017/08/01/begincontour开始负形状/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表