Why rotateX function not working

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(); // крутим
}

Hello,

This has a good description:
https://p5js.org/reference/#/p5/rotate

Try rotating before the shape and see what happens.

Reference:
https://p5js.org/reference/#/p5/rotateX

:)

1 Like

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().

2 Likes