> For the complete documentation index, see [llms.txt](https://learnpython.strivemath.com/p5-python-web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnpython.strivemath.com/p5-python-web/reference/controlling-the-environment/rectmode.md).

# rectMode()

By default, the **x** and **y** inputs refer to the bottom left corner of the rectangle.

This can be changed using `rectMode()`, with an input of **CORNER**, **CORNERS**, **RADIUS** or **CENTER.**

#### rectMode(CORNER)

This is the default mode. The code:

```python
rect(x, y, width, height)
```

will use **(x,y)** as the bottom left corner coordinates and **width** and **height** as the dimensions.

![](/files/shG4i6oTQ06TP16i5bXN)

#### rectMode(CORNERS)

This mode is for specifying the coordinates of opposite corners. The code:

```python
rect(x1, y2, x2, y2)
```

will use **(x1,y1)** as the bottom left corner coordinates and **(x2,y2)** as the top right (diagonally opposite) corner coordinates.

![](/files/hmIe2jga8QfwEhNfqaLD)

#### rectMode(CENTER)

This mode is for specifying the **center** of the rectangle together with the **width** and **height**. The code:

```python
rect(x, y, width, height)
```

will use **(x,y)** as the center coordinates and **width** and **height** as the dimensions.

![](/files/2Nq9kgvJDAoEWfC5B08E)

#### rectMode(RADIUS)

This mode is for specifying the **center** of the rectangle together with **half the width** and **half the height**. The code:

**See** [**rect()**](/p5-python-web/reference/shapes/2d/rect.md#modes) **for examples and more info.**

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}
