end_shape()

The end_shape() function is the companion to begin_shape() and may only be called after begin_shape().

Examples

example picture for end_shape()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def setup():
    py5.no_fill()

    py5.begin_shape()
    py5.vertex(20, 20)
    py5.vertex(45, 20)
    py5.vertex(45, 80)
    py5.end_shape(py5.CLOSE)

    py5.begin_shape()
    py5.vertex(50, 20)
    py5.vertex(75, 20)
    py5.vertex(75, 80)
    py5.end_shape()

Description

The end_shape() function is the companion to begin_shape() and may only be called after begin_shape(). When end_shape() is called, all of image data defined since the previous call to begin_shape() 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).

Underlying Java method: endShape

Syntax

end_shape() -> None
end_shape(mode: int, /) -> None

Parameters

  • mode: int - use CLOSE to close the shape

Updated on September 11, 2021 16:51:34pm UTC