> 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/built-in-functions/translate.md).

# translate()

### Examples

![](/files/B6sQYsXNjNsKB5mgVnnL)

```python
translate(100,100)
square(50,100,100)
```

![](/files/sglWEPviQmQe0e85E48D)

```python
translate(mouseX,mouseY)
square(50,100,100)
```

### Syntax

```python
translate(x,y)
```

<table><thead><tr><th>Input</th><th>Description</th><th data-hidden></th><th data-hidden></th></tr></thead><tbody><tr><td>x</td><td>Horizontal translation (left/right)</td><td></td><td></td></tr><tr><td>y</td><td>Vertical translation(up/down)</td><td></td><td></td></tr></tbody></table>

<figure><img src="/files/pq4K2iHTUdKTL9vvXTK2" alt=""><figcaption><p><strong>a) Translated tick axes</strong>     <strong>b) Square moved to new position (150,200)</strong></p></figcaption></figure>

### Description

The `translate()` function is used to **move the origin point of the coordinate system** to a new location.&#x20;

When you call the `translate()` function, all subsequent drawing commands will be relative to the new origin point. This means that if you draw a shape or line at position `(50, 50)` after calling `translate(100, 100)`, it will actually appear at position `(150, 150)` on the canvas.

{% 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 %}
