Search processing.org:

Reference for Processing version 1.0.1+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name

### rectMode()

Examples

    rectMode(CENTER);
    rect(35, 35, 50, 50);
    rectMode(CORNER);
    fill(102);
    rect(35, 35, 50, 50);

Description

Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters of rect() to specify the image's width and height. The syntax rectMode(RADIUS) draws the image from its center point and uses the third and forth parameters of rect() to specify half of the image's width and height. The parameter must be written in ALL CAPS because Processing is a case sensitive language. Note: In version 125, the mode named CENTER_RADIUS was shortened to RADIUS.

Syntax

    rectMode(MODE)

Parameters

MODE | Either CORNER, CORNERS, CENTER, or RADIUS

Returns | None
Usage | Web & Application
Related | rect()

Updated on November 22, 2008 08:39:26pm PST