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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learnpython.strivemath.com/p5-python-web/reference/built-in-functions/translate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
