Py5Graphics.shape_mode()

Modifies the location from which shapes draw.

Description

Modifies the location from which shapes draw. The default mode is shape_mode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of Py5Graphics.shape() to specify the width and height. The syntax shape_mode(CORNERS) uses the first and second parameters of Py5Graphics.shape() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax shape_mode(CENTER) draws the shape from its center point and uses the third and forth parameters of Py5Graphics.shape() to specify the width and height. The parameter must be written in ALL CAPS because Python is a case sensitive language.

This method is the same as shape_mode() but linked to a Py5Graphics object. To see example code for how it can be used, see shape_mode().

Underlying Java method: PGraphics.shapeMode

Syntax

shape_mode(mode: int, /) -> None

Parameters

  • mode: int - either CORNER, CORNERS, CENTER

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