Py5Shape#

Datatype for storing shapes.

Examples#

example picture for Py5Shape

def setup():
    global s
    # the file "bot.svg" must be in the data folder
    # of the current sketch to load successfully
    s = py5.load_shape("bot.svg")


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

example picture for Py5Shape

def setup():
    global s  # the Py5Shape object
    # creating the Py5Shape as a square. the corner
    # is 0,0 so that the center is at 40,40
    s = py5.create_shape(py5.RECT, 0, 0, 80, 80)


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

Description#

Datatype for storing shapes. Before a shape is used, it must be loaded with the load_shape() or created with the create_shape(). The shape() function is used to draw the shape to the display window. Py5 can currently load and display SVG (Scalable Vector Graphics) and OBJ shapes. OBJ files can only be opened using the P3D renderer. The load_shape() function supports SVG files created with Inkscape and Adobe Illustrator. It is not a full SVG implementation, but offers some straightforward support for handling vector data. A more complete SVG implementation can be provided by convert_image() if Cairo is installed. See installation instructions for additional detail.

The Py5Shape object contains a group of methods that can operate on the shape data.

To create a new shape, use the create_shape() function. Do not use the syntax Py5Shape().

Underlying Processing class: PShape

The following methods and fields are provided:

Drawing#

Fill#

Stroke#

Material#

Properties#

Texture#

Object#

Organization#

Properties#

Transform#

Vertices#

Updated on March 06, 2023 02:49:26am UTC