# Translate Processing sketch into P5 issue

**URL:** <https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344>\
**Category:** Coding Questions\
**Created:** [August 18, 2020, 10:20pm UTC](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344 "2020-08-18T22:20:36Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 19, 2020, 3:40pm UTC](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344/16 "2020-08-19T15:40:56Z")

</div>

> [@chanof](#):
>
> I need to understand better how to get the right position

I gave an example to try:  
[https://discourse.processing.org/t/get-the-vertical-axis-of-objects-array/23319/3](https://discourse.processing.org/t/get-the-vertical-axis-of-objects-array/23319/3)

Here is another one (move the mouse to center it):

> **Code**
>
> ```auto
> float theta = 0;
> 
> void setup() 
> {
> size(300, 300);
> }
> 
> void draw() 
> {
> background(0);
> translate(width/2, height/2);
>   
> noFill();
> circle(0, 0, 100);
> 
> theta += TAU/360;
>   
> int num = int(map(mouseX, 0, width, -200, 100)); //This comes in very handy!
> textSize(24);
> text(num, 70, 0);
> 
> rotate(theta);
> translate(num, 0); //This will translate it to center
>   
> stroke(255, 255, 0);
> strokeWeight(2);
> line(0, 0, 100, 0);  
> }
> 
> ```

Take a look at the tutorials:  
[2D Transformations / Processing.org](https://processing.org/tutorials/transform2d/) After that 3D.

And the other resources at the [Processing](https://processing.org/) site.

`:)`

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2b423bc3d1b04ea89726621c9f798d50e1214b98.png)

---

_[View the full topic](https://discourse.processing.org/t/translate-processing-sketch-into-p5-issue/23344)._
