Datatype for storing shapes.
1def setup(): 2 global s 3 # the file "bot.svg" must be in the data folder 4 # of the current sketch to load successfully 5 s = py5.load_shape("bot.svg") 6 7 8def draw(): 9 py5.shape(s, 10, 10, 80, 80)
1def setup(): 2 global s # the Py5Shape object 3 # creating the Py5Shape as a square. the corner 4 # is 0,0 so that the center is at 40,40 5 s = py5.create_shape(py5.RECT, 0, 0, 80, 80) 6 7 8def draw(): 9 py5.shape(s, 10, 10)
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.
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
Underlying Processing class: PShape
The following methods and fields are provided:
Updated on November 12, 2021 11:30:58am UTC