create_shape() function is used to define a new shape.
create_shape() function is used to define a new shape. Once created, this shape can be drawn with the Py5Graphics.shape() function. The basic way to use the function defines new primitive shapes. One of the following parameters are used as the first parameter:
LINE. The parameters for each of these different shapes are the same as their corresponding functions: Py5Graphics.ellipse(), Py5Graphics.rect(), Py5Graphics.arc(), Py5Graphics.triangle(), Py5Graphics.sphere(), Py5Graphics.box(), Py5Graphics.quad(), and Py5Graphics.line().
Custom, unique shapes can be made by using
create_shape() without a parameter. After the shape is started, the drawing attributes and geometry can be set directly to the shape within the Py5Graphics.begin_shape() and Py5Graphics.end_shape() methods. See reference for Py5Graphics.begin_shape() for all of its options.
create_shape() function can also be used to make a complex shape made of other shapes. This is called a “group” and it’s created by using the parameter
GROUP as the first parameter.
create_shape(), stroke and fill color can be set by calling methods like Py5Shape.set_fill() and Py5Shape.set_stroke(), as seen in the examples. The complete list of methods and fields for the Py5Shape class are in the py5 documentation.
Underlying Processing method: PGraphics.createShape
create_shape() -> Py5Shape create_shape( kind: int, # either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE /, *p: float, ) -> Py5Shape create_shape( type: int, # either GROUP, PATH, or GEOMETRY /, ) -> Py5Shape
Updated on March 06, 2023 02:49:26am UTC