# Despite translation my square isn't rotating properly

**URL:** https://discourse.processing.org/t/despite-translation-my-square-isnt-rotating-properly/34831
**Category:** Beginners
**Created:** [January 24, 2022, 11:00pm UTC](https://discourse.processing.org/t/despite-translation-my-square-isnt-rotating-properly/34831 "2022-01-24T23:00:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![goldorak](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@goldorak](https://discourse.processing.org/u/goldorak)
#### Post date: [January 24, 2022, 11:00pm UTC](https://discourse.processing.org/t/despite-translation-my-square-isnt-rotating-properly/34831/1 "2022-01-24T23:00:39Z")

</div>

Hi,

I’ve been struggling with rotating my squares.  
My rectmode is centered and I use degrees. I also understood I need to use translation as well but my square isn’t rotating properly.

Here is my very simple code

```auto
function setup() { 
  createCanvas(400, 400);
  rectMode(CENTER);
   angleMode = DEGREES;
  noLoop();
} 

function draw() { 
  background(220);
	
  translate (width/2, height/2);
  rotate(90);
rect(0, 0, 100, 100);
}

```

Would you have any idea?

Thanks

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 24, 2022, 11:05pm UTC](https://discourse.processing.org/t/despite-translation-my-square-isnt-rotating-properly/34831/2 "2022-01-24T23:05:27Z")

</div>

```auto
angleMode(DEGREES); // Change the mode to DEGREES

```

Not sure if a rotation by 90 deg is visible because it looks the same

Alternatively try 70 or 45 degrees

---

<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: [January 25, 2022, 11:52am UTC](https://discourse.processing.org/t/despite-translation-my-square-isnt-rotating-properly/34831/3 "2022-01-25T11:52:25Z")

</div>

Hello @goldorak,

There are resources here:  
[https://p5js.org/](https://p5js.org/)

A search for _rotate_ on p5.js website reveals:  
[https://p5js.org/reference/#/p5/rotate](https://p5js.org/reference/#/p5/rotate)

Are you using the p5.js Web editor?  
[https://editor.p5js.org/](https://editor.p5js.org/)

Your code:

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

Look up the reference for _AngleMode()_ which is also in the _rotate()_ reference.

Cut a square piece of paper.  
Rotate it 90 degrees.

Once you correct the _angleMode()_ that is what you are seeing… a square rotated 90 degrees.

Try something like a line before and after the rotate(90).  
`line(0, 0, 100, 100);`

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

`:)`
