# translate()

### Examples

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FU9bxFNEgxHwJbFc8FE2z%2Fimage.png?alt=media\&token=b789dbc4-cd4e-436f-9704-80fe762e2230)

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

![](https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FrpwNAqEkSTLS3kC3IVu5%2FtranslateGIF.gif?alt=media\&token=25007e11-d2af-4c34-994d-148853f66e79)

```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="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FPKSQqjpE6FfL2eGCydNI%2Ftran%203.drawio.png?alt=media&#x26;token=c4ccc384-c7a5-4710-85e7-9543004b651b" 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 %}
