Rotate a smilie around its center

Hello,

i try to write a method that rotates my Smilie object around its center axis.
The show() function draws the complete object based on the center coordinates.
The problem is that when I try to rotate the whole thing with

pushMatrix();
translate(x, y);
rotate(radians(80); // Will later be an incrementing variable
popMatrix();

The smilie is flying around the screen and it’s not behaving as I thought it would.

source code:

Main

Smilie Smilie;


void settings () {
  size(1000, 1000);
}


void setup () {
  Smilie = new Smilie();
}


void draw () {
  background(255);
  Smilie.LA = 'n';
  Smilie.RA = 'k';
  Smilie.show();
}

Class

class Smilie {

  float x;
  float y;
  float size;
  char LA;
  char RA;
  float posLax;
  float posLay;
  float posRax;
  float posRay;
  color c = color(255, 236, 1);
  PFont font = createFont("Arabic.ttf", 20);





  Smilie() {

    x = width/2;
    y = height/2;
    size = 500;
    posLax = x-size*0.18;
    posLay = y+46;
    posRax = x+size*0.18;
    posRay = y+46;
    strokeWeight(size*0.05);
    strokeCap(PROJECT);
  }

  Smilie(float tempX, float tempY, float tempSize) {

    x = tempX;
    y = tempY;
    size = tempSize;
    posLax = x-size*0.18;
    posLay = y+46;
    posRax = x+size*0.18;
    posRay = y+46;
    strokeWeight(size*0.05);
    strokeCap(PROJECT);
  }

  void show() {
    
    float mouth = size*0.7;
    fill(c);
    circle(x, y, size);
    noFill();
    pushMatrix();
    translate(x, y);
    rotate(radians(10));
    arc(x, y, mouth, mouth, radians(0), radians(180));
    eyes(LA, RA);
    popMatrix();
  }


  void eyes(char L, char R) {  
    textFont(font);
    fill(30);
    textSize(size*0.3);
    textAlign(CENTER, BOTTOM);
    text(L, posLax, posLay);
    text(R, posRax, posRay);
  }

  void spin(float speed) {
    
  }
}

Try arc(0, 0, …) instead of arc(x, y, …) since you’ve already translated to (x,y). You might also want to redefine posLax and posLay accordingly - i.e. relative to (width/2, height/2).

Thank You!!

arc(0, 0…) worked! It can be so simple sometimes…

I already tried to make posLax and posLay relative but I think the offset does come from the font somehow. I need to investigate that further.