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

shapeMode()

Examples
example pic
PShape bot 

void setup() {
  size(100, 100);
  bot = loadShape("bot.svg");
}

void draw() {
  shapeMode(CENTER);
  shape(bot, 35, 35, 50, 50);
  shapeMode(CORNER);
  shape(bot, 35, 35, 50, 50);
}
Description Modifies the location from which shapes draw. The default mode is shapeMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of shape() to specify the width and height. The syntax shapeMode(CORNERS) uses the first and second parameters of shape() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax shapeMode(CENTER) draws the shape from its center point and uses the third and forth parameters of shape() to specify the width and height. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language.
Syntax
shapeMode(mode)
Parameters
mode int: either CORNER, CORNERS, CENTER
Returnsvoid
RelatedPShape
shape()
rectMode()
Updated on January 21, 2019 10:05:11am EST

Creative Commons License