# Hey guys if I want my text to be in the middle what can I change?

**URL:** <https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346>\
**Category:** Coding Questions\
**Created:** [April 16, 2019, 9:09am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346 "2019-04-16T09:09:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 16, 2019, 9:09am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/1 "2019-04-16T09:09:50Z")

</div>

```auto
PFont myFont;

String s1= ("OBECALP PHARMACY ");
float angleSpeed= TWO_PI/s1.length();
float letterX,letterY;
int i,cntX,cntY;
int radius =260;

float z=random(TWO_PI);
float x=0;
float y;
float r =0;

float offset;
float ntext;

float t=100;

float angle,c,x1,y1=0;
float speed = 0;
int waveStrengthHorizontal= 5;
int waveStrengthVertical= 5;

float u,v;
void setup() {
  size(800, 800, P3D);
  background(255);
  myFont = createFont("DrukTextWide-Heavy.ttf", 20);
  //textFont(myFont);
frameRate(20);
}

void draw() {
background(255);

i=s1.length();
printQuote();
}

void printQuote(){
  
 
  
int count =0;
for(y=0; y<500; y++){
if(count%10==0)
  {
  
int cntY =0, cntX =width/2;
for (int j = 0; j < i; j++) 

{
    letterX = cntX + radius * cos(j*angleSpeed);
    letterY = cntY + radius * sin(j*angleSpeed);
    
    
     
          
pushMatrix();

rotateY(r);
//rotateX(x1);

 translate(letterX, cntX, letterY);
 textSize(20);
 
 fill(0, 0, 0);
 text(s1.charAt(j),x,y);
 t++;

  popMatrix();
  
}
}
count++;
r=r+0.0001; angle+=10;
//speed=0.01;
  }
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [April 16, 2019, 9:12am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/2 "2019-04-16T09:12:04Z")

</div>

[https://processing.org/reference/textAlign\_.html](https://processing.org/reference/textAlign_.html)

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 16, 2019, 9:17am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/3 "2019-04-16T09:17:51Z")

</div>

it’s not that i tried =/

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 16, 2019, 9:18am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/4 "2019-04-16T09:18:11Z")

</div>

i think it’s the r function

---

<div class="post-metadata">

**Author:** ![fwtini](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@fwtini](https://discourse.processing.org/u/fwtini)\
**Post date:** [April 16, 2019, 9:27am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/5 "2019-04-16T09:27:35Z")

</div>

Now it stops spinning but it’s in the center haha now can i do to spinning =/

```auto
PFont myFont;

String s1= ("OBECALP PHARMACY ");
float angleSpeed= TWO_PI/s1.length();
float letterX,letterY;
int i,cntX,cntY;
int radius =260;

float z=random(TWO_PI);
float x=0;
float y;
float r =0;

float angle,c,x1,y1=0;
float speed = 0;
int waveStrengthHorizontal= 5;
int waveStrengthVertical= 5;

float u,v;
void setup() {
  size(800, 800, P3D);
  background(255);
  myFont = createFont("DrukTextWide-Heavy.ttf", 20);
  //textFont(myFont);
frameRate(20);
}

void draw() {
background(255);

i=s1.length();
printQuote();
}

void printQuote(){
  
 
  
int count =0;
for(y=0; y<500; y++){
if(count%10==0)
  {
  
int cntY =0, cntX =width/2;
for (int j = 0; j < i; j++) 

{
    letterX = cntX + radius * cos(j*angleSpeed);
    letterY = cntY + radius * sin(j*angleSpeed);
    
    
     
          
pushMatrix();

//rotateY(r);
//rotateX(200);

 translate(letterX, cntY, letterY);
 textSize(20);
 
 fill(0, 0, 0);
 text(s1.charAt(j),x,y);
 

  popMatrix();
  
}
}
count++;
//r=r+0.0001; angle+=10;
//speed=0.01;
  }
}

```

---

<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:** [April 16, 2019, 10:56am UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/6 "2019-04-16T10:56:19Z")

</div>

> [@fwtini](#):
>
> translate(letterX, cntY, letterY);

Using cntY in this line is not wise since you use it in another spot with another purpose

Hence either use 0 or name a new variable like heightCircle

---

<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:** [April 16, 2019, 1:55pm UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/7 "2019-04-16T13:55:44Z")

</div>

> [@fwtini](#):
>
> rotateY(r);

It depends on what you want to achieve and you don’t explain this.

Spinnig what around which axis?

You might want rotateY (r); before the 2nd for loop

---

<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:** [April 18, 2019, 6:24pm UTC](https://discourse.processing.org/t/hey-guys-if-i-want-my-text-to-be-in-the-middle-what-can-i-change/10346/8 "2019-04-18T18:24:50Z")

</div>

continued other thread

> [@Hallo! Can you explain me why my text doesn't spinning?](https://discourse.processing.org/t/hallo-can-you-explain-me-why-my-text-doesnt-spinning/10288):
>
> PFont myFont; String s1= ("OBECALP PHARMACY "); float angleSpeed= TWO\_PI/s1.length(); float letterX,letterY; int i,cntX,cntY; int radius =260; float z=random(TWO\_PI); float x; float y; //float rotX,rotY,rotZ; float r = 100; float angVel = -TWO\_PI / 360; float ang; void setup() { size(800, 800, P3D); background(255); myFont = createFont("DrukTextWide-Heavy.ttf", 20); //textFont(myFont); frameRate(20); } void draw() { background(255); rotate(ang); ang += angVel; float a…
