This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

shape()

Examples
example pic
PShape s;

void setup() {
  s = loadShape("bot.svg");
}

void draw() {
  shape(s, 10, 10, 80, 80);
}
Description Draws shapes to the display window. Shapes must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the shape. Processing currently works with SVG, OBJ, and custom-created shapes. The shape parameter specifies the shape to display and the coordinate parameters define the location of the shape from its upper-left corner. The shape is displayed at its original size unless the c and d parameters specify a different size. The shapeMode() function can be used to change the way these parameters are interpreted.
Syntax
shape(shape)
shape(shape, x, y)
shape(shape, a, b, c, d)
Parameters
shape PShape: the shape to display
x float: x-coordinate of the shape
y float: y-coordinate of the shape
a float: x-coordinate of the shape
b float: y-coordinate of the shape
c float: width to display the shape
d float: height to display the shape
Returnsvoid
RelatedPShape
loadShape()
shapeMode()
Updated on January 1, 2021 03:38:08am EST