Py5Graphics.ellipse_mode()#

Modifies the location from which ellipses are drawn by changing the way in which parameters given to Py5Graphics.ellipse() are intepreted.

Description#

Modifies the location from which ellipses are drawn by changing the way in which parameters given to Py5Graphics.ellipse() are intepreted.

The default mode is ellipse_mode(CENTER), which interprets the first two parameters of Py5Graphics.ellipse() as the shape’s center point, while the third and fourth parameters are its width and height.

ellipse_mode(RADIUS) also uses the first two parameters of Py5Graphics.ellipse() as the shape’s center point, but uses the third and fourth parameters to specify half of the shapes’s width and height.

ellipse_mode(CORNER) interprets the first two parameters of Py5Graphics.ellipse() as the upper-left corner of the shape, while the third and fourth parameters are its width and height.

ellipse_mode(CORNERS) interprets the first two parameters of Py5Graphics.ellipse() as the location of one corner of the ellipse’s bounding box, and the third and fourth parameters as the location of the opposite corner.

The parameter must be written in ALL CAPS because Python is a case-sensitive language.

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

Underlying Processing method: PGraphics.ellipseMode

Syntax#

ellipse_mode(mode: int, /) -> None

Parameters#

  • mode: int - either CENTER, RADIUS, CORNER, or CORNERS

Updated on November 12, 2021 11:30:58am UTC