Py5Shape.begin_shape()

This method is used to start a custom shape created with the create_shape() function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def setup():
    global s  # the Py5Shape object
    s = py5.create_shape()
    s.begin_shape()
    s.fill(0, 0, 255)
    s.no_stroke()
    s.vertex(0, 0)
    s.vertex(0, 50)
    s.vertex(50, 0)
    s.end_shape()


def draw():
    py5.shape(s, 25, 25)

Description

This method is used to start a custom shape created with the create_shape() function. It’s always and only used with create_shape().

Underlying Java method: PShape.beginShape

Syntax

begin_shape() -> None
begin_shape(kind: int, /) -> None

Parameters

  • kind: int - Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP

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