Name

endShape()

Description

The endShape() function is the companion to beginShape() and may only be called after beginShape(). When endshape() is called, all the image data defined since the previous call to beginShape() is written into the image buffer. The constant CLOSE as the value for the MODE parameter to close the shape (to connect the beginning and the end).

Examples

  • size(400, 400);
    noFill();
    
    beginShape();
    vertex(80, 80);
    vertex(180, 80);
    vertex(180, 320);
    endShape(CLOSE);
    
    beginShape();
    vertex(200, 80);
    vertex(300, 80);
    vertex(300, 320);
    endShape();
    Image output for example 1

Syntax

  • endShape()
  • endShape(mode)

Parameters

  • mode(int)use CLOSE to close the shape

Return

  • void