beginShape() vertex() endShape()

Hello,

If I create my own design with the vertex function, can I fill it with color or with greyscale? If I use line and stroke, and create a rectangle, can I add color to that rectangle?

Thank you very much,

Answers

  • fill();

  • Call it before drawing.

  • Answer ✓

    Like this.

    Kf

    void setup() { 
      size(550, 550);
      noLoop();
    }
    
    void draw() {
      background(0);
      fill(255, 250, 20);
      beginShape();
      vertex(50, 50);
      vertex(200, 50);
      vertex(200, 200);
      vertex(50, 200);
      vertex(50, 50);
      endShape();
    }
    
Sign In or Register to comment.