加工中两条线之间的空隙怎么填色?

How to fill color in the are between two lines in processing?

我有两行如下: 线(0,200,宽度,250); 线 (0, 250, 宽度, 300);

如何填充它们之间的区域?

我试过:

fill (250,250,25);
 beginShape ();
  line (0,200, width,250);
  line (0, 250, width, 300);
 endShape();

但是好像不行。

你不能像这样将 line() 与 beginShape() 一起使用。相反,使用 vertex() 函数来填充您的区域。像这样:

beginShape();
vertex(30, 20);
vertex(85, 20);
vertex(85, 75);
vertex(30, 75);
endShape(CLOSE);

可以在 the reference 中找到更多信息。