shape()

Draws shapes to the display window.

Examples

example picture for shape()
1
2
3
4
5
6
7
def setup():
    global s
    s = py5.load_shape("bot.svg")


def draw():
    py5.shape(s, 10, 10, 80, 80)

Description

Draws shapes to the display window. Shapes must be in the Sketch’s “data” directory to load correctly. Py5 currently works with SVG, OBJ, and custom-created shapes. The shape parameter specifies the shape to display and the coordinate parameters define the location of the shape from its upper-left corner. The shape is displayed at its original size unless the c and d parameters specify a different size. The shape_mode() function can be used to change the way these parameters are interpreted.

Underlying Java method: shape

Syntax

shape(shape: Py5Shape, /) -> None
shape(shape: Py5Shape, a: float, b: float, c: float, d: float, /) -> None
shape(shape: Py5Shape, x: float, y: float, /) -> None

Parameters

  • a: float - x-coordinate of the shape

  • b: float - y-coordinate of the shape

  • c: float - width to display the shape

  • d: float - height to display the shape

  • shape: Py5Shape - the shape to display

  • x: float - x-coordinate of the shape

  • y: float - y-coordinate of the shape

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