> 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/createvector.md).

# createVector()

### Example

<figure><img src="/files/Cwo0p3GpC86IGdxLjm7p" alt=""><figcaption></figcaption></figure>

```python
point = createVector(200, 100)
circle(point.x, point.y,mouseX )
```

### Syntax

```
createVector([x], [y], [z])
```

<table><thead><tr><th width="219">Input</th><th>Description</th></tr></thead><tbody><tr><td>x</td><td>horizontal component of the vector</td></tr><tr><td>y</td><td>vertical component of the vector</td></tr><tr><td>z(optional)</td><td>depth component of the vector (in case of 3D)</td></tr></tbody></table>

### Description

The `createVector()` function  is used to **create a 2D or 3D vector**, which is essentially an object with `x`, `y`, and optionally `z` properties that represent a magnitude and direction in space.

Once you have created a vector using the `createVector()` function, you can access its components using the `x`, `y`, and `z` properties.

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