# Why rotateX function not working

**URL:** <https://discourse.processing.org/t/why-rotatex-function-not-working/39097>\
**Category:** Beginners\
**Created:** [October 5, 2022, 11:26am UTC](https://discourse.processing.org/t/why-rotatex-function-not-working/39097 "2022-10-05T11:26:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timob256](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@timob256](https://discourse.processing.org/u/timob256)\
**Post date:** [October 5, 2022, 11:26am UTC](https://discourse.processing.org/t/why-rotatex-function-not-working/39097/1 "2022-10-05T11:26:54Z")

</div>

I call rotateX, but for some reason it does not work.

All code :

```
function setup() {
	createCanvas( 200, 200, WEBGL);
	angle = 0.0; // так тоже работает _angle = 0
	
    my_point_size = 20; 
	my_layer = 170;       
}
function feet() {
     R1 = 10; 
	
	// первый слой 
	 angle_t1 = 0;
	
	for( i = 0; my_point_size/4>= i; i++)
    {
        point(R1*cos(angle_t1), R1*sin(angle_t1), 0);
       angle_t1 +=(TWO_PI)/(my_point_size/2);
    }
   
   R2_x = R1;
   R2_y = 0.0;
   
    for( i = 0; my_point_size/4 >= i; i++)
    {
        R2_y -= R1/2;
        point(R2_x, R2_y, 0);
    }
    
    angle_t1 -=(TWO_PI)/(my_point_size/2);
    for( i = 0; my_point_size/4 >= i; i++)
    {
        point(R1*cos(angle_t1), R2_y + R1*sin(angle_t1), 0);
       angle_t1 +=(TWO_PI)/(my_point_size/2);
    }
    
      R2_x = -R1;
      for( i = 0; my_point_size/4 >= i; i++)
    {
        R2_y += R1/2;
        point(R2_x, R2_y, 0);
    }
}

function legs() { 
	feet() ;
}

function my_rotate() {
	rotateX(angle);
	//rotateY(_angle);
	//rotateZ(_angle);
	
	angle += 0.1;
}
	
function draw() {
	background(220,220,220, 5);
	
	// rectMode(CENTER); //центритует рисунок
	stroke(0, 0, 156, 200); // даëм точке цвет
	strokeWeight(3); // ширина точки
	
	legs() ; // рисуем
    my_rotate(); // крутим
}

```

---

<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:** [October 5, 2022, 1:26pm UTC](https://discourse.processing.org/t/why-rotatex-function-not-working/39097/2 "2022-10-05T13:26:18Z")

</div>

Hello,

This has a good description:  
[https://p5js.org/reference/#/p5/rotate](https://p5js.org/reference/#/p5/rotate)

Try rotating before the shape and see what happens.

Reference:  
[https://p5js.org/reference/#/p5/rotateX](https://p5js.org/reference/#/p5/rotateX)

`:)`

---

<div class="post-metadata">

**Author:** ![scudly](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/scudly/32/5597_2.png) [@scudly](https://discourse.processing.org/u/scudly)\
**Post date:** [October 5, 2022, 3:53pm UTC](https://discourse.processing.org/t/why-rotatex-function-not-working/39097/3 "2022-10-05T15:53:09Z")

</div>

rotate, translate, and scale affect any drawing commands that happen AFTER they are called, so move your `my_rotate();` call to before your `legs();` function call in `draw()`.
